1. If class A has two nested classes B and C. Class D has one nested class E, and have inherited class A. If E inherits B and C, then:
Correct Answer is : Multiple inheritance among nested classes, and single level for enclosing classes
2. In hierarchical inheritance, all the classes involve some kind of inheritance. (True/ False)
Correct Answer is : FALSE
3. Which type of inheritance cannot involve private inheritance?
Correct Answer is : All types can have private inheritance
4. How many classes can be inherited by a single class in multiple inheritance (C++)?
Correct Answer is : Any number of classes can be inherited
5. How many classes can be inherited by a single class in java?
Correct Answer is : Only 1
6. If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go on?
Correct Answer is : There is no limit
7. How many types of member functions are possible in general?
8. Simple member functions are ______________________
Correct Answer is : Ones defined simply without any type
9. What are static member functions?
Correct Answer is : Functions using only static data and can be accessed directly in main() function
10. How can static member function can be accessed directly in main() function?
Correct Answer is : Scope resolution operator
11. Correct syntax to access the static member functions from the main() function is:
Correct Answer is : className::functionName();
12. What are const member functions?
Correct Answer is : Functions which treat all the data members as constant and doesn’t allow changes
13. Which among the following best describes the inline member functions?
Correct Answer is : Functions defined inside the class or with the keyword inline
14. What are friend member functions (C++)?
Correct Answer is : Non-member functions which have access to all the members (including private) of a class
15. What is the syntax of a const member function?
Correct Answer is : void fun() const {}
16. Which keyword is used to make a nonmember function as friend function of a class?
Correct Answer is : friend
17. Member functions _____________________
Correct Answer is : Must be defined outside the class body
18. All type of member functions can’t be used inside a single class.
Correct Answer is : FALSE
19. Which among the following is true?
Correct Answer is : Member functions can be defined in any access specifier
20. Which keyword is used to define the static member functions?
Correct Answer is : static