Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C++ Programming
»
Constructors and Destructors
Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?
Preprocessor
Linker
Loader
Compiler
Correct Answer:
Compiler
← Previous Question
Next Question→
More Questions from
Constructors and Destructors
Which of the following never requires any arguments?
How many times a constructor is called in the life-time of an object?
Which of the following statement is correct whenever an object goes out of scope?
Which of the following gets called when an object is being created?
Which constructor function is designed to copy objects of the same class type?
What will be the out of the following program? #include
class CuriousTabBase { public: int x, y; public: CuriousTabBase(int xx = 0, int yy = 0) { x = xx; y = yy; } }; class CuriousTabDerived : public CuriousTabBase { private: CuriousTabBase objBase; public: CuriousTabDerived(int xx, int yy) : CuriousTabBase(xx), objBase(yy) { cout << this->x << " " << this->y << " " << objBase.x << " " << objBase.y << " "; } ~CuriousTabDerived() { } }; int main() { CuriousTabDerived objDev(11, 22); return 0; }
Which of the following statement is correct about the program given below? #include
class CuriousTab { public: CuriousTab() { cout<< "Curious"; } ~CuriousTab() { cout<< "Tab"; } }; int main() { CuriousTab objTab; return 0; }
What will be the output of the following program? #include
class CuriousTabBase { public: CuriousTabBase() { cout<< "Base OK. "; } ~CuriousTabBase() { cout<< "Base DEL. "; } }; class CuriousTabDerived: public CuriousTabBase { public: CuriousTabDerived() { cout<< "Derived OK. "; } ~CuriousTabDerived() { cout<< "Derived DEL. "; } }; int main() { CuriousTabBase *basePtr = new CuriousTabDerived(); delete basePtr; return 0; }
What will be the output of the following program? #include
class CuriousTab { int x; public: CuriousTab(int xx, float yy) { cout<< char(yy); } }; int main() { CuriousTab *p = new CuriousTab(35, 99.50f); return 0; }
What will be the output of the following program? #include
int val = 0; class CuriousTab { public: CuriousTab() { cout<< ++val; } ~CuriousTab() { cout<< val--; } }; int main() { CuriousTab objCuriousTab1, objCuriousTab2, objCuriousTab3; { CuriousTab objCuriousTab4; } return 0; }
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments