Object Oriented Programming interview questions part 50

Object Oriented Programming interview questions part 50

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

Total Questions: 20

1. Which specifier applies only to the constructors?

Correct Answer is : Explicit

2. Which among the following is true?

Correct Answer is : Default constructor can be called explicitly

3. Which type of constructor can’t have a return type?

Correct Answer is : Constructors don’t have a return type

4. Why do we use static constructors?

Correct Answer is : To initialize the static members of class

5. When and how many times a static constructor is called?

Correct Answer is : Called at first time when an object is created and only one time

6. Which among the following is true for static constructor?

Correct Answer is : Static constructors can’t be parameterized constructors

7. Within a class, only one static constructor can be created.

Correct Answer is : TRUE

8. Default constructor initializes all data members as:

Correct Answer is : All numeric member with zero and strings to null

9. When is the static constructor called?

Correct Answer is : Before first instance is created

10. If constructors of a class are defined in private access, then:

Correct Answer is : The class can’t be inherited

11. Which among the following is correct, based on the given code below: class student { int marks; public : student() { cout<<”New student details can be added now”; } }; student s1;

Correct Answer is : This program works fine

12. How many types of inheritance are possible in C++?

Correct Answer is : 5

13. Which among the following is true?

Correct Answer is : Java doesn’t support multiple inheritance

14. Which type of inheritance is illustrated by the following code? class student{ public: int marks; }; class topper: public student { public: char grade; }; class average{ public: int makrs_needed; }; class section: public average{ public: char name[10]; }; class overall: public average{ public: int students; };

Correct Answer is : Hierarchical

15. Which among the following best describes multiple inheritance?

Correct Answer is : More than one class being parent of single child

16. How many types of inheritance can be used at a time in single program?

Correct Answer is : Any type, any number of times

17. Which type of inheritance results in diamond problem?

Correct Answer is : Hybrid

18. If 6 classes uses single level inheritance with pair classes (3 pairs), which inheritance will this be called?

Correct Answer is : Single

19. Which among the following is correct for the following code? class A { public : class B { public : B(int i): data(i) { } int data; } }; class C: public A { class D:public A::B{ }; };

Correct Answer is : Single level inheritance is used, with both enclosing and nested classes

20. Which among the following is false?

Correct Answer is : Hybrid inheritance always contains multiple inheritance

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon