Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Constructors are used to
Correct Answer is : bool value evaluates to false
2. When struct is used instead of the keyword class means, what will happen in the program?
Correct Answer is : bool cannot be used as the type of the result of the function
3. Which category of data type a class belongs to?
Correct Answer is : bool cannot be used as the type of the result of the function
4. Which operator a pointer object of a class uses to access its data members and member functions?
Correct Answer is : 0
5. What is the output of the following C++ code?
#include
#include
using namespace std;
class A
{
int a;
public:
int assign(int i) const {
a = i;
}
int return_value() const {
return a;
}
};
int main(int argc, char const *argv[])
{
A obj;
obj.assign(5);
cout<
Correct Answer is : 0
6. What is the correct syntax of accessing a static member of a Class?
---------------------------
Example class:
class A
{
public:
static int value;
}
---------------------------
Correct Answer is : #ERROR!
7. How the objects are self-referenced in a member function of that class.
Correct Answer is : #ERROR!
8. What does a mutable member of a class mean?
Correct Answer is : 52
9. What is the output of the following C++ code?
#include
#include
using namespace std;
class A
{
mutable int a;
public:
int assign(int i) const {
a = i;
}
int return_value() const {
return a;
}
};
int main(int argc, char const *argv[])
{
A obj;
obj.assign(5);
cout<
Correct Answer is : 52
10. Pick the incorrect statement about inline functions in C++?
Correct Answer is : 16
11. Inline functions are avoided when ____________________________
Correct Answer is : 16
12. Pick the correct statement.
Correct Answer is : 1
13. What is the output of the following C++ code?
#include
using namespace std;
class S
{
int m;
public:
#define MAC(S::m)
};
int main(int argc, char const *argv[])
{
cout<<"Hello World";
return 0;
}
Correct Answer is : 1
14. What is the output of the following C++ code?
#include
#include
using namespace std;
class A
{
static int a;
public:
void change(int i){
a = i;
}
void value_of_a(){
cout<
15. What is the output of the following C++ code?
#include
#include
using namespace std;
class A
{
static int a;
public:
void change(int i){
a = i;
}
void value_of_a(){
cout<
16. What is the output of the following C++ code?
#include
#include
using namespace std;
class A
{
int a = 5;
public:
void change(int i){
a = i;
}
static void value_of_a(){
cout<