JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Object Oriented Programming interview questions part 51
Object Oriented Programming interview questions part 51
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
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:
A. It shows multiple inheritance
B. It shows hierarchical inheritance
C. It shows multiple inheritance
D. Multiple inheritance among nested classes, and single level for enclosing classes
Show Correct Answer
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)
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
3. Which type of inheritance cannot involve private inheritance?
A. Single level
B. Multiple
C. Hybrid
D. All types can have private inheritance
Show Correct Answer
Correct Answer is :
All types can have private inheritance
4. How many classes can be inherited by a single class in multiple inheritance (C++)?
A. Only 2
B. Only 27
C. Only 1024
D. Any number of classes can be inherited
Show Correct Answer
Correct Answer is :
Any number of classes can be inherited
5. How many classes can be inherited by a single class in java?
A. Only 1
B. Only 27
C. Only 255
D. Only 1024
Show Correct Answer
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?
A. Only till class C
B. Only till class J
C. Only till class Z
D. There is no limit
Show Correct Answer
Correct Answer is :
There is no limit
7. How many types of member functions are possible in general?
A. 2
B. 3
C. 4
D. 5
Show Correct Answer
Correct Answer is :
5
8. Simple member functions are ______________________
A. Ones defined simply without any type
B. Ones defined with keyword simple
C. Ones that are implicitly provided
D. Ones which are defined in all the classes
Show Correct Answer
Correct Answer is :
Ones defined simply without any type
9. What are static member functions?
A. Functions which use only static data member but can’t be accessed directly
B. Functions which uses static and other data members
C. Functions which can be access outside the class with the data members
D. Functions using only static data and can be accessed directly in main() function
Show Correct Answer
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?
A. Dot operator
B. Colon
C. Scope resolution operator
D. Arrow operator
Show Correct Answer
Correct Answer is :
Scope resolution operator
11. Correct syntax to access the static member functions from the main() function is:
A. classObject::functionName();
B. className::functionName();
C. className:classObject:functionName();
D. className.classObject:functionName();
Show Correct Answer
Correct Answer is :
className::functionName();
12. What are const member functions?
A. Functions in which none of the data members can be changed in a program
B. Functions in which only static members can be changed
C. Functions which treat all the data members as constant and doesn’t allow changes
D. Functions which can change only the static members
Show Correct Answer
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?
A. Functions defined inside the class only
B. Functions with keyword inline only
C. Functions defined outside the class
D. Functions defined inside the class or with the keyword inline
Show Correct Answer
Correct Answer is :
Functions defined inside the class or with the keyword inline
14. What are friend member functions (C++)?
A. Member function which can access all the members of a class
B. Member function which can modify any data of a class
C. Member function which doesn’t have access to private members
D. Non-member functions which have access to all the members (including private) of a class
Show Correct Answer
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?
A. void fun() const {}
B. void fun() constant {}
C. void const fun() {}
D. const void fun(){}
Show Correct Answer
Correct Answer is :
void fun() const {}
16. Which keyword is used to make a nonmember function as friend function of a class?
A. friendly
B. new
C. friend
D. connect
Show Correct Answer
Correct Answer is :
friend
17. Member functions _____________________
A. Must be defined inside class body
B. Can be defined inside class body or outside
C. Must be defined outside the class body
D. Can be defined in another class
Show Correct Answer
Correct Answer is :
Must be defined outside the class body
18. All type of member functions can’t be used inside a single class.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
19. Which among the following is true?
A. Member functions can never be private
B. Member functions can never be protected
C. Member functions can never be public
D. Member functions can be defined in any access specifier
Show Correct Answer
Correct Answer is :
Member functions can be defined in any access specifier
20. Which keyword is used to define the static member functions?
A. static
B. stop
C. open
D. state
Show Correct Answer
Correct Answer is :
static
Similar Interview Questions
Search for latest jobs
Find Jobs