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 statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
2.
How many types of polymorphisms are supported by C++?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
The two main types of polymorphism are run-time (implemented as inheritance and virtual functions), and compile-time (implemented as templates).
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
3.
Which one of the following is correct about the statements given below?
- All function calls are resolved at compile-time in Procedure Oriented Programming.
- All function calls are resolved at compile-time in OOPS.
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 not a type of inheritance?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
5.
Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.
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.
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
8.
Which of the following statement is correct about the program given below?
#include<iostream.h>
static double gDouble;
static float gFloat;
static double gChar;
static double gSum = 0;
class BaseOne
{
public:
void Display(double x = 0.0, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class BaseTwo
{
public:
void Display(int x = 1, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class Derived : public BaseOne, BaseTwo
{
void Show()
{
cout << gSum;
}
};
int main()
{
Derived objDev;
objDev.BaseTwo::Display(10, 20, 'Z');
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 statements is correct?
- Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
- A reference is not a constant pointer.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
10.
Which of the following statement is correct about the program given below?
#include<iostream.h>
int main()
{
int arr[] = {1, 2 ,3, 4, 5};
int &zarr = arr;
for(int i = 0; i <= 4; i++)
{
arr[i] += arr[i];
}
for(i = 0; i <= 4; i++)
cout<< zarr[i];
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 IndiaBix
{
int x, y;
public:
IndiaBix(int &xx, int &yy)
{
x = xx;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x1 = 10;
int &p = x1;
int y1 = 20;
int &q = y1;
IndiaBix objBix(p, q);
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 statements about virtual base classes is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
14.
Which of the following can be overloaded?
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>
#include<string.h>
class IndiaBix
{
public:
void GetData(char *s, int x, int y )
{
int i = 0;
for (i = x-1; y>0; i++)
{
cout<< s[i];
y--;
}
}
};
int main()
{
IndiaBix objBix;
objBix.GetData((char*)"Welcome!", 1, 3);
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 cannot be declared as virtual?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
18.
How many times a constructor is called in the life-time of an object?
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 incorrect?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
20.
Can a class have virtual destructor?
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