Online C++ Programming Test - C++ Programming Test 4
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.
How many instances of an abstract class can be created?
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 header file includes definition of cin and cout?
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 provides a reuse mechanism?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
4.
How "Late binding" is implemented in C++?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
5.
Why reference is not same as a pointer?
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 type of class allows only one object of it to be created?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
7.
Which of the following function / types of function cannot have default parameters?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
8.
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 : Functions
9.
Which of the following statement will be correct if the function has three arguments passed to it?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
10.
What is correct about the following program?
#include<iostream.h>
class Base
{
int x, y, z;
public:
Base()
{
x = y = z = 0;
}
Base(int xx, int yy = 'A', int zz = 'B')
{
x = xx;
y = x + yy;
z = x + y;
}
void Display(void)
{
cout<< x << " " << y << " " << z << endl;
}
};
class Derived : public Base
{
int x, y;
public:
Derived(int xx = 65, int yy = 66) : Base(xx, yy)
{
y = xx;
x = yy;
}
void Display(void)
{
cout<< x << " " << y << " ";
Display();
}
};
int main()
{
Derived objD;
objD.Display();
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
11.
What will be the output of the following program?
#include<iostream.h>
struct IndiaBix
{
int arr[5];
public:
void BixFunction(void);
void Display(void);
};
void IndiaBix::Display(void)
{
for(int i = 0; i < 5; i++)
cout<< arr[i] << " " ;
}
void IndiaBix::BixFunction(void)
{
static int i = 0, j = 4;
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp ;
i++;
j--;
if(j != i) BixFunction();
}
int main()
{
IndiaBix objBix = {{ 5, 6, 3, 9, 0 }};
objBix.BixFunction();
objBix.Display();
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
12.
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 : References
13.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x, y;
public:
void SetValue(int &a, int &b)
{
a = 100;
x = a;
y = b;
Display();
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x = 10;
IndiaBix objBix;
objBix.SetValue(x, x);
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
14.
Which of the following also known as an instance of a class?
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 two entities (reading from Left to Right) can be connected by the dot operator?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
16.
Constructor is executed when _____.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
17.
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
18.
Which of the following gets called when an object goes out of scope?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
19.
It is a __________ error to pass arguments to a destructor.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
20.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x;
public:
IndiaBix(short ss)
{
cout<< "Short" << endl;
}
IndiaBix(int xx)
{
cout<< "Int" << endl;
}
IndiaBix(char ch)
{
cout<< "Char" << endl;
}
~IndiaBix()
{
cout<< "Final";
}
};
int main()
{
IndiaBix *ptr = new IndiaBix('B');
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