#include class Base { public: char S, A, M; Base(char x, char y) { S = y - y; A = x + x; M = x * x; } Base(char, char y = 'A', char z = 'B') { S = y; A = y + 1 - 1; M = z - 1; } void Display(void) { cout
A A A
A B A
A B C
Garbage Garbage Garbage
The program will report compile time error.
Explanation:-
Answer: Option A. -> A A A
Question 2.
What will be the output of the following program?
#include class Base { public: int S, A, M; Base(int x, int y) { S = y - y; A = x + x; M = x * x; } Base(int, int y = 'A', int z = 'B') { S = y; A = y + 1 - 1; M = z - 1; } void Display(void) { cout
65 65 65
65 66 67
A A A
A B C
The program will report compile time error.
Explanation:-
Answer: Option A. -> 65 65 65
Question 3.
Which of the following statement is correct about the program given below?
Answer: Option D. -> The program will report compile-time error.
Question 4.
What is correct about the following program?
#include 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
The program will report compilation error.
The program will run successfully giving the output 66 65.
The program will run successfully giving the output 65 66.
The program will run successfully giving the output 66 65 65 131 196.
The program will produce the output 66 65 infinite number of times (or till stack memory overflow).
Explanation:-
Answer: Option C. -> The program will run successfully giving the output 65 66.
Question 5.
What will be the output of the following program?
#include class Base { int x, y; public: Base() { x = y = 0; } Base(int xx) { x = xx; } Base(int p, int q = 10) { x = p + q; }objDefault(1, 1); y = q; } void Display(void) { cout
3 2
8 3
11 6
11 10
The program will not compile successfully.
Explanation:-
Answer: Option C. -> 11 6
Question 6.
What will be the output of the following program?
#include class Number { int Num; public: Number(int x = 0) { Num = x; } void Display(void) { cout 0 ) Modify() ; if(Dec == 10) cout
130
A0
B0
90
Explanation:-
Answer: Option B. -> A0
Question 7.
What will be the output of the following program?
#include class AreaFinder { float l, b, h; float result; public: AreaFinder(float hh = 0, float ll = 0, float bb = 0) { l = ll; b = bb; h = hh; } void Display(int ll) { if(l = 0) result = 3.14f * h * h; else result = l * b; cout
0
314
314.0000
200.0000
Explanation:-
Answer: Option A. -> 0
Question 8.
What is correct about the following program?
#include class Addition { int x; public: Addition() { x = 0; } Addition(int xx) { x = xx; } Addition operator + (int xx = 0) { Addition objTemp; objTemp.x = x + xx; return(objTemp); } void Display(void) { cout
The program will print the output 20.
The program will report run time error.
The program will print the garbage value.
Compilation fails due to 'operator +' cannot have default arguments.
Explanation:-
Answer: Option D. -> Compilation fails due to 'operator +' cannot have default arguments.
Question 9.
What will be the output of the following program?
#include class BaseCounter { protected: long int count; public: void CountIt(int x, int y = 10, int z = 20) { count = 0; cout
30 10 20
Garbage 10 20
40 50 20
20 40 50
40 Garbage Garbage
Explanation:-
Answer: Option C. -> 40 50 20
Question 10.
What will be the output of the following program?
#include class TestDrive { int x; public: TestDrive(int xx) { x = xx; } int DriveIt(void); }; int TestDrive::DriveIt(void) { static int value = 0; int m; m = x % 2; x = x / 2; if((x / 2)) DriveIt(); value = value + m * 10; return value; } int main() { TestDrive TD(1234); cout