Online C++ Programming Test - C++ Programming Test - Random
Instruction:
- This is a FREE online test. Beware of scammers who ask for money to attend this test.
- Total number of questions: 20.
- Time allotted: 30 minutes.
- Each question carries 1 mark; there are no negative marks.
- DO NOT refresh the page.
- All the best!
Marks : 2/20
Total number of questions
20
Number of answered questions
0
Number of unanswered questions
20
Test Review : View answers and explanation for this test.
1.
Which of the following operators cannot be overloaded?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
2.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
3.
Which of the following is not the member of class?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
4.
Which of the following is an abstract data type?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
5.
Which of the following statements regarding inline functions is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
6.
Which of the following statement is incorrect?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
7.
What will be the output of the following program?
#include<iostream.h>
class Bix
{
int x, y;
public:
void show(void);
void main(void);
};
void Bix::show(void)
{
Bix b;
b.x = 2;
b.y = 4;
cout<< x << " " << y;
}
void Bix::main(void)
{
Bix b;
b.x = 6;
b.y = 8;
b.show();
}
int main(int argc, char *argv[])
{
Bix run;
run.main();
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
8.
What will be the output of the following program?
#include<iostream.h>
struct MyData
{
public:
int Addition(int a, int b = 10)
{
return (a *= b + 2);
}
float Addition(int a, float b);
};
int main()
{
MyData data;
cout<<data.Addition(1)<<" ";
cout<<data.Addition(3, 4);
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
9.
Which of the following statement is correct about the program given below?
#include<iostream.h>
const double BixConstant(const int, const int = 0);
int main()
{
const int c = 2 ;
cout<< BixConstant(c, 10)<< " ";
cout<< BixConstant(c, 20)<< endl;
return 0;
}
const double BixConstant(const int x, const int y)
{
return( (y + (y * x) * x % y) * 0.2);
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
10.
Which of the following statement is correct about the program given below?
#include<iostream.h>
enum bix
{
a=1, b, c
};
int main()
{
int x = c;
int &y = x;
int &z = x;
y = b;
cout<< z--;
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
11.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class Bix
{
int x, y;
public:
Bix(int x, int y)
{
this->x = x;
this->y = y;
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x = 50;
int &y = x ;
Bix b(y, x);
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
12.
Which of the following statement is correct about the program given below?
#include<iostream.h>
enum xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = ++x;
q = ++y;
r = ++c;
cout<< p << q << r;
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
13.
Which of the following statement is correct regarding destructor of base class?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
14.
What will be the output of the following program?
#include<iostream.h>
#include<string.h>
class IndiaBix
{
char str[50];
char tmp[50];
public:
IndiaBix(char *s)
{
strcpy(str, s);
}
int BixFunction()
{
int i = 0, j = 0;
while(*(str + i))
{
if(*(str + i++) == ' ')
*(tmp + j++) = *(str + i);
}
*(tmp + j) = 0;
return strlen(tmp);
}
};
int main()
{
char txt[] = "Welcome to IndiaBix.com!";
IndiaBix objBix(txt);
cout<< objBix.BixFunction();
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
15.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class BixBase
{
int x, y;
public:
BixBase(int xx = 10, int yy = 10)
{
x = xx;
y = yy;
}
void Show()
{
cout<< x * y << endl;
}
};
class BixDerived : public BixBase
{
private:
BixBase objBase;
public:
BixDerived(int xx, int yy) : BixBase(xx, yy)
{
objBase.Show();
}
};
int main()
{
BixDerived objDev(10, 20);
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
16.
A constructor that accepts __________ parameters is called the default constructor.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
17.
Which of the following statements are correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
18.
Which of the following gets called when an object is being created?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
19.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
20.
What is the technical word for the function ~IndiaBix() defined in the following program?
#include<iostream.h>
class IndiaBix
{
int x, y;
public:
IndiaBix(int xx = 10, int yy = 20 )
{
x = xx;
y = yy;
}
void Display()
{
cout<< x << " " << y << endl;
}
~IndiaBix()
{ }
};
int main()
{
IndiaBix objBix;
objBix.Display();
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers