| 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. Copy constructor definition requires __________________

Correct Answer is : Object to be passed by reference

2. What is the type of object that should be specified in argument list?

Correct Answer is : Class name of object

3. If an object is passed by value, _________________

Correct Answer is : Local object in the function is used

4. Can data members be passed to a function using the object?

Correct Answer is : Yes, only if the data members are public and are being passed to a function outside the class

5. What exactly is passed when an object is passed by reference?

Correct Answer is : The exact address of the object in memory

6. If the object is not to be passed to any function but the values of the object have to be used then:

Correct Answer is : The data members should be passed separately

7. Which among the following is true?

Correct Answer is : Any number of objects can be passed to a function

8. What will be the output if all necessary code is included (Header files and main function)? void test (Object &y) { y = "It is a string"; } void main() { Object x = null; test (x); System.out.println (x); }

Correct Answer is : It is a string

9. In which type is new memory location will be allocated?

Correct Answer is : Only in pass by value

10. Pass by reference and pass by value can’t be done simultaneously in a single function argument list.

Correct Answer is : FALSE

11. Which language among the following doesn’t allow pointers?

Correct Answer is : Java

12. Which is correct syntax for declaring pointer to object?

Correct Answer is : className* objectName;

13. Which operator should be used to access the members of the class using object pointer?

Correct Answer is : Arrow operator

14. How does compiler decide the intended object to be used, if more than one object are used?

Correct Answer is : Using this pointer

15. If pointer to an object is declared, ___________

Correct Answer is : It can only store object address of class type specified

16. What is the size of object pointer?

Correct Answer is : Equal to size of any usual pointer

17. A pointer _________________

Correct Answer is : Can point to only one object at a time

18. Pointer to a base class can be initialized with the address of derived class, because of _________

Correct Answer is : derived-to-base implicit conversion for pointers

19. Can pointers to object access the private members of the class?

Correct Answer is : No, never

20. Is name of an array of objects is also a pointer to object?

Correct Answer is : Yes, always