Object Oriented Programming interview questions part 23

Object Oriented Programming interview questions part 23

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Which type of data can a local class access from the function in which it is defined?

Correct Answer is : Static and extern

2. Local classes can access the type names and enumerators defined by the enclosing function.

Correct Answer is : TRUE

3. Can static variables be declared inside a local class?

Correct Answer is : No, not possible anyway

4. All the member functions of local classes are __________ by default.

Correct Answer is : Abstract

5. The enclosing function has no special access to the members of local class. (True/False)

Correct Answer is : TRUE

6. Which language can use inheritance with local classes?

Correct Answer is : SAP ABAP

7. How many local classes can be defined inside a single function?

Correct Answer is : As many as required

8. All the data members of local class must be ___________

Correct Answer is : Defined in constructor

9. Can two different functions have local class with same name?

Correct Answer is : Yes, since local

10. What is the scope of local class?

Correct Answer is : Within the function

11. Can a function, other than the enclosing function of local class, access the class members?

Correct Answer is : No, can’t access

12. Which among the following is main advantage of using local classes?

Correct Answer is : Helps to add extra functionality to a function

13. Which among the following best describes member functions?

Correct Answer is : Functions belonging a class

14. How many types of member functions are generally there in C++?

Correct Answer is : 5

15. How can a static member function be called in main function?

Correct Answer is : Using dot, arrow or using scope resolution operator with class name

16. What are inline member functions?

Correct Answer is : Member functions whose definition is expanded in place of its call

17. What happens if non static members are used in static member function?

Correct Answer is : Compile time error

18. Static member functions _____________

Correct Answer is : Doesn’t contain “this” pointer

19. How to access members of the class inside a member function?

Correct Answer is : Used directly or with this pointer

20. For overloading “( )”, “[ ]” or “->” operators, a class __________

Correct Answer is : Must be non-static member and should not be friend of class

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon