< Back To Cplusplus Tests
C++ Test 3
1. Which of the following is true?
Static methods cannot be overloaded.
Non-static data members can be accessed by static methods.
Static data members can only be accessed by static methods.
Static methods can only access static members (data and methods)
2. Predict the output of the following code.
breakInterview is static
3. Assume that an integer takes 4 bytes and there is no alignment in following classes, predict the output.
4. Predict the output of the following code.
No Compiler Error
Compiler Error in line “Base *bp = new Derived;”
Compiler Error in line ” Derived *dp = new Base;”
5. Predict the output of the following code.
6. Predict the output of the following code.
7. What happens when delete is used for a NULL pointer?
8. Is it fine to call delete twice for a pointer?
9. Can a constructor be virtual? Will the following program compile?
10. Predict the output of the following code.
Bank & SSC
© 2018 BreakInerview