This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
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 referenceI got this question in an interview for job.This key question is from Returning Objects topic in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right answer is (B) INDIVIDUAL data members can be returned |
|
| 52. |
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 createdThis question was addressed to me in an international level competition.My query is from Returning Objects in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct answer is (d) Temporary object is not created |
|
| 53. |
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 errorThis question was addressed to me in homework.This intriguing question originated from Returning Objects in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT answer is (C) Compile time ERROR |
|
| 54. |
How many independent objects can be returned at same time from a function?(a) 1(b) 2(c) 3(d) 4I got this question in an online quiz.Enquiry is from Returning Objects in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The correct choice is (a) 1 |
|
| 55. |
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 allThe question was asked in a job interview.Origin of the question is Returning Objects in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct OPTION is (b) It can’t be returned by REFERENCE |
|
| 56. |
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()This question was posed to me in an online interview.My question is from Returning Objects topic in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right answer is (a) className& functionName ( ) |
|
| 57. |
Which is the correct syntax for returning an object by value?(a) void functionName ( ){ }(b) object functionName( ) { }(c) class object functionName( ) { }(d) ClassName functionName ( ){ }The question was posed to me during an interview for a job.My doubt stems from Returning Objects in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» CORRECT option is (d) CLASSNAME functionName ( ){ } EASY explanation - The class NAME itself should be the return type of the function. This NOTIFIES that the function will return an object of specified class type. Only the class name should be specified. |
|
| 58. |
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 functionI had been asked this question in quiz.Enquiry is from Returning Objects in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct ANSWER is (b) Within the function |
|
| 59. |
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 createdThis question was addressed to me in class test.My question is taken from Returning Objects in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct answer is (a) A temporary object is CREATED |
|
| 60. |
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 referenceThis question was addressed to me in homework.The question is from Returning Objects topic in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT answer is (c) Can be returned either by value or reference |
|
| 61. |
Pass by reference and pass by value can’t be done simultaneously in a single function argument list.(a) True(b) FalseThe question was posed to me in exam.This question is from Passing Object to Functions topic in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct choice is (B) False |
|
| 62. |
In which type is new memory location will be allocated?(a) Only in pass by reference(b) Only in pass by value(c) Both in pass by reference and value(d) Depends on the codeThis question was posed to me in my homework.This intriguing question comes from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right option is (b) Only in PASS by value |
|
| 63. |
Which among the following is true?(a) More than one object can’t be passed to a function(b) Any number of objects can be passed to a function(c) Objects can’t be passed, only data member values can be passed(d) Objects should be passed only if those are public in classI have been asked this question in an international level competition.This intriguing question originated from Passing Object to Functions topic in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct choice is (b) Any number of OBJECTS can be passed to a function |
|
| 64. |
If the object is not to be passed to any function but the values of the object have to be used then?(a) The data members should be passed separately(b) The data members and member functions have to be passed separately(c) The values should be present in other variables(d) The object must be passedI had been asked this question in final exam.My doubt is from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right choice is (a) The data members should be PASSED separately |
|
| 65. |
What exactly is passed when an object is passed by reference?(a) The original object name(b) The original object class name(c) The exact address of the object in memory(d) The exact address of data membersI have been asked this question in an internship interview.I need to ask this question from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right choice is (c) The exact address of the object in memory |
|
| 66. |
Can data members be passed to a function using the object?(a) Yes, it can be passed only inside class functions(b) Yes, only if the data members are public and are being passed to a function outside the class(c) No, can’t be passed outside the class(d) No, can’t be doneThe question was posed to me in final exam.This intriguing question originated from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT choice is (B) Yes, only if the data members are public and are being passed to a function outside the CLASS |
|
| 67. |
If an object is passed by value, _________________(a) Temporary object is used in the function(b) Local object in the function is used(c) Only the data member values are used(d) The values are accessible from the original objectThis question was addressed to me in an online quiz.My doubt stems from Passing Object to Functions in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right choice is (b) Local OBJECT in the function is used |
|
| 68. |
What is the type of object that should be specified in the argument list?(a) Function name(b) Object name itself(c) Caller function name(d) Class name of objectThe question was posed to me during an interview for a job.Asked question is from Passing Object to Functions in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Right choice is (d) CLASS NAME of object |
|
| 69. |
Copy constructor definition requires __________________(a) Object to be passed by value(b) Object not to be passed to it(c) Object to be passed by reference(d) Object to be passed with each data member valueThis question was addressed to me in exam.I want to ask this question from Passing Object to Functions in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct OPTION is (c) OBJECT to be passed by reference |
|
| 70. |
Pass by reference of an object to a function _______________(a) Affects the object in called function only(b) Affects the object in prototype only(c) Affects the object in caller function(d) Affects the object only if mentioned with & symbol with every callI had been asked this question by my college director while I was bunking the class.My question is based upon Passing Object to Functions topic in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT choice is (c) Affects the object in CALLER FUNCTION |
|
| 71. |
If object is passed by value ______________(a) Copy constructor is used to copy the values into another object in the function(b) Copy constructor is used to copy the values into temporary object(c) Reference to the object is used to access the values of the object(d) Reference to the object is used to created new object in its placeI have been asked this question during an interview.My question is from Passing Object to Functions topic in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct option is (a) Copy constructor is USED to copy the VALUES into another OBJECT in the function |
|
| 72. |
Which symbol should be used to pass the object by reference in C++?(a) &(b) @(c) $(d) $ or &The question was posed to me in examination.The doubt is from Passing Object to Functions topic in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT option is (a) & |
|
| 73. |
The object ________________(a) Can be passed by reference(b) Can be passed by value(c) Can be passed by reference or value(d) Can be passed with referenceThe question was posed to me in homework.I would like to ask this question from Passing Object to Functions in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» Correct answer is (c) Can be PASSED by reference or value |
|
| 74. |
Passing object to a function _______________(a) Can be done only in one way(b) Can be done in more than one ways(c) Is not possible(d) Is not possible in OOPThe question was posed to me in exam.This question is from Passing Object to Functions topic in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming |
|
Answer» The CORRECT option is (b) Can be DONE in more than one ways |
|