Object Oriented Programming interview questions part 11
Object Oriented Programming interview questions part 11
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Copy constructor is a constructor which ________________
Correct Answer is : Creates an object by initializing it with another previously created object of same class
2. The copy constructor can be used to:
Correct Answer is : Initialize one object from another object of same type
3. If two classes have exactly same data members and member function and only they differ by class name. Can copy constructor be used to initialize one class object with another class object?
Correct Answer is : No, not possible
4. The copy constructors can be used to ________
Correct Answer is : Copy an object so that it can be passed to a function
5. Which returning an object, we can use ____________
Correct Answer is : Copy constructor
6. If programmer doesn’t define any copy constructor then _____________
Correct Answer is : Compiler provides an implicit copy constructor
7. If a class implements some dynamic memory allocations and pointers then _____________
Correct Answer is : Copy constructor must be defined
9. Object being passed to a copy constructor ___________
Correct Answer is : Must be passed by reference
10. Out of memory error is given when the object _____________ to the copy constructor.
Correct Answer is : Is not passed by reference
11. Copy constructor will be called whenever the compiler __________
Correct Answer is : Generates temporary object
12. The deep copy is possible only with the help of __________
Correct Answer is : User defined copy constructor
13. Can a copy constructor be made private?
Correct Answer is : Yes, always
14. The arguments to a copy constructor _____________
Correct Answer is : Must be const
15. Copy constructors are overloaded constructors.
Correct Answer is : TRUE
16. What is the term used to indicate the variable and constants of a class?
Correct Answer is : Data members
17. Data members ________________ (C++)
Correct Answer is : Can be initialized only with help of constructors
18. Which among the following is true for data members?
Correct Answer is : Static data members are defined outside class, not in constructor
19. What should be done for data member to be of user defined structure type?
Correct Answer is : The structure must have been defined before class.
20. How many data members can a class contain?
Correct Answer is : As many as required
Similar Interview Questions
Search for latest jobs
Get $5 added to your wallet for registering an account. Refer others and get $1 for each successful referral. Earn while you search for jobs and redeem in gift cards!