Home
MCQS
C/C MCQ Quiz Hub
C Questions and Answers – Returning Objects
Choose a topic to test your knowledge and improve your C/C skills
1. In which of the following way(s) can the object be returned from a function?
Can only be returned by value
Can only be returned by reference
Can be returned either by value or reference
Can neither be returned by value nor by reference
2. Whenever an object is returned by value ____________________
A temporary object is created
Temporary object is not created
Temporary object may or may not be created
New permanent object is created
3. Where the temporary objects (created while return by value) are created?
Outside the function scope
Within the function
Inside the main function
Inside the calling function
4. Which is the correct syntax for returning an object by value?
void functionName ( ){ }
object functionName( ) { }
class object functionName( ) { }
ClassName functionName ( ){ }
5. Which is the correct syntax for defining a function which passes an object by reference?
className& functionName ( )
className* functionName( )
className-> functionName( )
&className functionName()
6. If an object is declared inside the function then ____________________ outside the function.
It can be returned by reference
It cant be returned by reference
It can be returned by address
It cant be returned at all
7. How many independent objects can be returned at same time from a function?
1
2
3
4
8. Which error will be produced if a local object is returned by reference outside a function?
Out of memory error
Run time error
Compile time error
No error
9. If object is passed by reference ____________________
Temporary object is created
Temporary object is created inside the function
Temporary object is created for few seconds
Temporary object is not created
10. Which among the following is correct?
Individual data members cant be returned
Individual data members can be returned
Individual member functions can be returned from another function
Individual data members can only be passed by reference
11. Can we return an array of objects?
Yes, always
Ye, only if objects are having same values
No, because objects contain many other values
No, because objects are single entity
12. Which among the following is true?
Two objects can point to the same memory location
Two objects can never point to the same memory location
Objects not allowed to point at a location already occupied
Objects cant point to any address
13. If an object is being returned by value then __________________________
Its member values are made constant
Its member values have to be copied individually
Its member values are not used
Its member values are copied using copy constructor
14. Why temporary object is not created in return by reference?
Because compiler cant create temporary objects
Because the temporary object is created within the function
Because return by reference just make the objects points to values memory location
Because return by reference just make the object point to null
Submit