Object Oriented Programming interview questions part 39

Object Oriented Programming interview questions part 39

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

Total Questions: 20

1. Which among the following is true?

Correct Answer is : The pointer to object can hold address only

2. Which is the correct syntax to call a member function using pointer?

Correct Answer is : pointer->function()

3. If pointer to an object is created and the object gets deleted without using the pointer:

Correct Answer is : It becomes dangling pointer

4. How can the address stored in the pointer be retrieved?

Correct Answer is : Using & symbol

5. What should be done to prevent changes that may be made to the values pointed by the pointer?

Correct Answer is : Pointer should be made const

6. References to object are same as pointers of object.

Correct Answer is : FALSE

7. Which among the following best describes polymorphism?

Correct Answer is : It is the ability for a message/data to be processed in more than one form

8. What do you call the languages that support classes but not polymorphism?

Correct Answer is : Object-based language

9. Which among the following is the language which supports classes but not polymorphism?

Correct Answer is : Ada

10. If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?

Correct Answer is : Polymorphism

11. Which class/set of classes can illustrate polymorphism in the following code: abstract class student { public : int marks; calc_grade(); } class topper:public student { public : calc_grade() { return 10; } }; class average:public student { public : calc_grade() { return 20; } }; class failed{ int marks; };

Correct Answer is : All class student, topper and average together can show polymorphism

12. Which type of function among the following shows polymorphism?

Correct Answer is : Virtual function

13. In case of using abstract class or function overloading, which function is supposed to be called first?

Correct Answer is : Function with highest priority in compiler

14. Which among the following can’t be used for polymorphism?

Correct Answer is : Static member functions

15. What is output of the following program? class student { public : int marks; void disp() { cout<<”its base class” }; class topper:public student { public : void disp() { cout<<”Its derived class”; } } void main() { student s; topper t; s.disp(); t.disp(); }

Correct Answer is : Its base classIts derived class

16. Which among the following can show polymorphism?

Correct Answer is : Overloading <<

17. Find the output of the program: class education { char name[10]; public : disp() { cout<<”Its education system”; } class school:public education { public: void dsip() { cout<<”Its school education system”; } }; void main() { school s; s.disp(); } }

Correct Answer is : Its school education system

18. Polymorphism is possible in C language.

Correct Answer is : TRUE

19. Which problem may arise if we use abstract class functions for polymorphism?

Correct Answer is : All the derived classes must implement the undefined functions

20. Which among the following is not true for polymorphism?

Correct Answer is : Increases overhead of function definition always

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon