JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Object Oriented Programming interview questions part 23
Object Oriented Programming interview questions part 23
Back
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?
A. Static and extern
B. Abstract and static
C. Void and extern
D. Const and static
Show Correct Answer
Correct Answer is :
Static and extern
2. Local classes can access the type names and enumerators defined by the enclosing function.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
3. Can static variables be declared inside a local class?
A. Yes, with public access specifier
B. Yes, anywhere as required
C. No, not possible in private access specifier
D. No, not possible anyway
Show Correct Answer
Correct Answer is :
No, not possible anyway
4. All the member functions of local classes are __________ by default.
A. Static
B. Inline
C. Abstract
D. Virtual
Show Correct Answer
Correct Answer is :
Abstract
5. The enclosing function has no special access to the members of local class. (True/False)
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
6. Which language can use inheritance with local classes?
A. Kotlin
B. Java
C. SmallTalk
D. SAP ABAP
Show Correct Answer
Correct Answer is :
SAP ABAP
7. How many local classes can be defined inside a single function?
A. Only 1
B. Only 3
C. Only 5
D. As many as required
Show Correct Answer
Correct Answer is :
As many as required
8. All the data members of local class must be ___________
A. Defined with declaration
B. Defined in constructor
C. Declared and defined in constructor
D. Declared using a member function
Show Correct Answer
Correct Answer is :
Defined in constructor
9. Can two different functions have local class with same name?
A. Yes, since local
B. No, names must be different
C. No, scope doesn’t work here
D. No, ambiguity arises
Show Correct Answer
Correct Answer is :
Yes, since local
10. What is the scope of local class?
A. Within the class only
B. Within the function
C. Within the program
D. One time creation and live till end of program
Show Correct Answer
Correct Answer is :
Within the function
11. Can a function, other than the enclosing function of local class, access the class members?
A. Yes, using object
B. Yes, using direct call
C. Yes, using pointer
D. No, can’t access
Show Correct Answer
Correct Answer is :
No, can’t access
12. Which among the following is main advantage of using local classes?
A. Make program more efficient
B. Makes program execution faster
C. Helps to add extra functionality to a function
D. Helps to add more members to a function
Show Correct Answer
Correct Answer is :
Helps to add extra functionality to a function
13. Which among the following best describes member functions?
A. Functions which are defined within the class
B. Functions belonging a class
C. Functions in public access of a class
D. Functions which are private to class
Show Correct Answer
Correct Answer is :
Functions belonging a class
14. How many types of member functions are generally there in C++?
A. 2
B. 3
C. 4
D. 5
Show Correct Answer
Correct Answer is :
5
15. How can a static member function be called in main function?
A. Using dot operator
B. Using arrow operator
C. Using dot or arrow operator
D. Using dot, arrow or using scope resolution operator with class name
Show Correct Answer
Correct Answer is :
Using dot, arrow or using scope resolution operator with class name
16. What are inline member functions?
A. Member functions which can be called without object
B. Member functions whose definition is expanded in place of its call
C. Member functions whose definition is faster than simple function
D. Member function which is defined in single line
Show Correct Answer
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?
A. Compile time error
B. Runtime error
C. Executes fine
D. Executes if that member function is not used
Show Correct Answer
Correct Answer is :
Compile time error
18. Static member functions _____________
A. Contains “this” pointer for data members
B. Contains “this” pointer if used for member functions
C. Doesn’t contain “this” pointer
D. Doesn’t contain “this” pointer if member functions are referred
Show Correct Answer
Correct Answer is :
Doesn’t contain “this” pointer
19. How to access members of the class inside a member function?
A. Using this pointer only
B. Using dot operator
C. Using arrow operator
D. Used directly or with this pointer
Show Correct Answer
Correct Answer is :
Used directly or with this pointer
20. For overloading “( )”, “[ ]” or “->” operators, a class __________
A. Must use static member functions
B. Must use non-static member functions
C. Must be non-static member and should not be friend of class
D. Must use static member function or a friend member function
Show Correct Answer
Correct Answer is :
Must be non-static member and should not be friend of class
Similar Interview Questions
Search for latest jobs
Find Jobs