| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

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

Total Questions: 20

1. Which keyword is used to define the inline member function?

Correct Answer is : inline

2. What is upcasting?

Correct Answer is : Casting subtype to supertype

3. Which among the following is true for upcasting in inheritance?

Correct Answer is : Upward to the inheritance tree

4. Which among the following is safe?

Correct Answer is : Upcasting

5. Which among the following is best situation to use upcasting?

Correct Answer is : For general code dealing with only supertype

6. Which property is shown most when upcasting is used?

Correct Answer is : Complex code simple syntax

7. Upcasting and downcasting objects is same as casting primitive types.

Correct Answer is : FALSE

8. Which casting among the following is allowed for the code given below? class A { public :int a; } class B:public A { int b; } main() { B b=new A(); //casting 1 A a=new B(); //casting 2 }

Correct Answer is : Casting 2

9. If multiple inheritance is implemented, which upcasting will be correct?

Correct Answer is : Upcast to any base class

10. If class C inherits class B and class B inherits class A ________________

Correct Answer is : Class C object can be upcasted to object of either class A or B

11. Upcasting is _____________________ without an explicit type cast.

Correct Answer is : Always allowed for public inheritance

12. Which concept is needed because of implicit type casting use?

Correct Answer is : Dynamic binding

13. When are the pointer types known for upcasting the objects?

Correct Answer is : Compile time

14. When are the object type known for upcasting the objects?

Correct Answer is : Runtime

15. If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?

Correct Answer is : Parent *p=&child;

16. Which among the following is true?

Correct Answer is : Upcasting is possible for any type of inheritance

17. Virtual function is ______ class function which expected to be redefined in ______ class, so that when reference is made to derived class object using pointer then we can call virtual function to execute ________ class definition version.

Correct Answer is : Base, derived, derived

18. What does a virtual function ensure for an object, among the following?

Correct Answer is : Correct method is called, regardless of the type of reference used for function call

19. Virtual functions are mainly used to achieve _____________

Correct Answer is : Runtime polymorphism

20. Which keyword is used to declare virtual functions?

Correct Answer is : virtual