

MCQOPTIONS
Saved Bookmarks
This section includes 16 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
Why temporary object is not created in return by reference? |
A. | Because compiler can’t create temporary objects |
B. | Because the temporary object is created within the function |
C. | Because return by reference just make the objects points to values memory location |
D. | Because return by reference just make the object point to null |
Answer» D. Because return by reference just make the object point to null | |
2. |
If an object is being returned by value then __________________________ |
A. | Its member values are made constant |
B. | Its member values have to be copied individually |
C. | Its member values are not used |
D. | Its member values are copied using copy constructor |
Answer» E. | |
3. |
If an object is passed by reference to a function then it must be returned by reference. |
A. | True |
B. | False |
Answer» C. | |
4. |
Can we return an array of objects? |
A. | Yes, always |
B. | Ye, only if objects are having same values |
C. | No, because objects contain many other values |
D. | No, because objects are single entity |
Answer» B. Ye, only if objects are having same values | |
5. |
If object is passed by reference ____________________ |
A. | Temporary object is created |
B. | Temporary object is created inside the function |
C. | Temporary object is created for few seconds |
D. | Temporary object is not created |
Answer» E. | |
6. |
Which error will be produced if a local object is returned by reference outside a function? |
A. | Out of memory error |
B. | Run time error |
C. | Compile time error |
D. | No error |
Answer» D. No error | |
7. |
How many independent objects can be returned at same time from a function? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» B. 2 | |
8. |
If an object is declared inside the function then ____________________ outside the function. |
A. | It can be returned by reference |
B. | It can’t be returned by reference |
C. | It can be returned by address |
D. | It can’t be returned at all |
Answer» C. It can be returned by address | |
9. |
Which is the correct syntax for defining a function which passes an object by reference? |
A. | className& functionName ( ) |
B. | className* functionName( ) |
C. | className-> functionName( ) |
D. | &className functionName() |
Answer» B. className* functionName( ) | |
10. |
Which is the correct syntax for returning an object by value? |
A. | void functionName ( ){ } |
B. | object functionName( ) { } |
C. | class object functionName( ) { } |
D. | ClassName functionName ( ){ } |
Answer» E. | |
11. |
Where the temporary objects (created while return by value) are created? |
A. | Outside the function scope |
B. | Within the function |
C. | Inside the main function |
D. | Inside the calling function |
E. | are created?a) Outside the function scopeb) Within the functionc) Inside the main functiond) Inside the calling function |
Answer» C. Inside the main function | |
12. |
Whenever an object is returned by value ____________________ |
A. | A temporary object is created |
B. | Temporary object is not created |
C. | Temporary object may or may not be created |
D. | New permanent object is created |
Answer» B. Temporary object is not created | |
13. |
In which of the following way(s) can the object be returned from a function? |
A. | Can only be returned by value |
B. | Can only be returned by reference |
C. | Can be returned either by value or reference |
D. | Can neither be returned by value nor by reference |
Answer» D. Can neither be returned by value nor by reference | |
14. |
IF_OBJECT_IS_PASSED_BY_REFERENCE_____________________?$ |
A. | Temporary object is created |
B. | Temporary object is created inside the function |
C. | Temporary object is created for few seconds |
D. | Temporary object is not created |
Answer» E. | |
15. |
Can we return an array of objects?$ |
A. | Yes, always |
B. | Ye, only if objects are having same values |
C. | No, because objects contain many other values |
D. | No, because objects are single entity |
Answer» B. Ye, only if objects are having same values | |
16. |
Which_among_the_following_is_correct?$ |
A. | Individual data members can’t be returned |
B. | Individual data members can be returned |
C. | Individual member functions can be returned from another function |
D. | Individual data members can only be passed by reference |
Answer» C. Individual member functions can be returned from another function | |