Agilent Interview questions

Agilent Interview questions
1]. What are the default member functions included in the class definition ?
2]. Does default destructor provided by the compiler?
3]. How to make a class to restrict its number of instances to 5?
4]. What is singleton class? Design it.
5]. What will happen?
A a1;
/* Some other code */

6]. main(){
int x=5;

7]. main(){
int x=5;

8]. What are the various storage classes ?
A. Extern, Static, Auto, Register

9]. Is this right ? Why or Why not?
static extern int x;
Ans: No, It will give compilation error. "more than one storage class specified", Reason is obvious.

10]. What is the need of writing our own copy constructor when it is by default provided by the compiler?

11]. What is object slicing?

12]. What is stack unwinding?

13]. Can we use references as class member variables?
Ans: Yes, we can. But then it must be initialized in constructor base/member initializer list. e.g.
class A{
int x;
int &y;
cout<<"A x="<<<" y="<<

No comments: