Object Oriented Programming interview questions part 44
Object Oriented Programming interview questions part 44
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Which is the correct syntax for defining a function which passes an object by reference?
Correct Answer is : className& functionName ( )
2. If an object is declared inside the function then ____________________ outside the function
Correct Answer is : It can’t be returned by reference
3. How many independent objects can be returned at same time from a function?
Correct Answer is : 1
4. Which error will be produced if a local object is returned by reference outside a function?
Correct Answer is : Compile time error
5. If object is passed by reference ____________________
Correct Answer is : Temporary object is not created
6. Which among the following is correct?
Correct Answer is : Individual data members can be returned
7. Can we return an array of objects?
Correct Answer is : Yes, always
8. If an object is passed by reference to a function then it must be returned by reference.
Correct Answer is : FALSE
9. Which among the following is true?
Correct Answer is : Two objects can point to the same memory location
10. If an object is being returned by value then __________________________
Correct Answer is : Its member values are copied using copy constructor
11. Why temporary object is not created in return by reference?
Correct Answer is : Because return by reference just make the objects points to values memory location
12. Which among the following defines single level inheritance?
Correct Answer is : One derived class inherits from one base class
13. If class A and class B are derived from class C and class D, then ________________
Correct Answer is : Those are 2 pairs of single inheritance
14. If single inheritance is used, program will contain ________________
Correct Answer is : At least 2 classes
15. Single level inheritance supports _____________ inheritance.
Correct Answer is : Runtime
16. Which method in the code below is single level inherited?
class A
{
protected int a, b;
public: void show()
{
cout<<a<<b;
}
};
class B: public A
{
public: void disp()
{
cout<<a++<<b++;
}
};
class C: private A, public B
{
void avg()
{
cout<<(a+b)/2;
}
};
Correct Answer is : Class B
17. If single level inheritance is used and an abstract class is created with some undefined functions, can its derived class also skip some definitions?
Correct Answer is : No, the derived class must implement those methods
18. Which among the following is false for single level inheritance?
Correct Answer is : There can be more than 2 independent classes involved in single inheritance
19. Which concept will result in derived class with more features (consider maximum 3 classes)?
Correct Answer is : Multiple inheritance
20. Single level inheritance is safer than _____________