Professional Documents
Culture Documents
#include <iostream>
using namespace std;
class Program{
int id;
static int count;
public:
Program() {
count++;
id = count;
cout << "constructor for id " << id << endl;
}
~Program() {
cout << "destructor for id " << id << endl;
}
};
int Program::count = 0; //Global Definition
int main() {
Program a[3];
return 0;
}
A. constructor for id 1 constructor for id 2 constructor for id 3 destructor for id
3 destructor for id 2 destructor for id 1
B. constructor for id 1 constructor for id 2 constructor for id 3 destructor for id
1 destructor for id 2 destructor for id 3
C. Compiler Dependent
D. constructor for id 1
Correct Answer : A
Q.3 Which of the following statements are true about Catch handler?
i) It must be placed immediately after try block T.
ii) It can have multiple parameters.
iii) There must be only one catch handler for every try block.
iv) There can be multiple catch handler for a try block T.
v) Generic catch handler can be placed anywhere after try block.
A. Only i, iv, v
B. Only i, ii, iii
C. Only i, iv
D. Only i, ii
Correct Answer : C
Q.4 How many objects reference can refer during its lifetime?
A. 1
B. 2
C. 3
D. 4
Correct Answer : A
Q.10 Which of the following operator is not allowed to overload using non member
function.
A. =
B. [ ]
C. < >
D. ( )
Correct Answer : C