C/C /C Questions and Answers ��� Returning Objects Sample Test,Sample questions

Question:
 How many independent objects can be returned at same time from a function?

1.1

2.2

3.3

4.4


Question:
 If object is passed by reference ____________________

1.Temporary object is created

2.Temporary object is created inside the function

3.Temporary object is created for few seconds

4.Temporary object is not created


Question:
 In which of the following way(s) can the object be returned from a function?

1.Can only be returned by value

2.Can only be returned by reference

3.Can be returned either by value or reference

4.Can neither be returned by value nor by reference


Question:
 Which among the following is true?

1.Two objects can point to the same memory location

2. Two objects can never point to the same memory location

3.Objects not allowed to point at a location already occupied

4.Objects cant point to any address


Question:
Can we return an array of objects?

1.Yes, always

2.Ye, only if objects are having same values

3.No, because objects contain many other values

4.No, because objects are single entity


Question:
If an object is being returned by value then __________________________

1.Its member values are made constant

2.Its member values have to be copied individually

3.Its member values are not used

4.Its member values are copied using copy constructor


Question:
If an object is declared inside the function then ____________________ outside the function.

1. It can be returned by reference

2.It cant be returned by reference

3.It can be returned by address

4.It cant be returned at all


Question:
Whenever an object is returned by value ____________________

1.A temporary object is created

2.Temporary object is not created

3.Temporary object may or may not be created

4.New permanent object is created


Question:
Where the temporary objects (created while return by value) are created?

1.Outside the function scope

2.Within the function

3.Inside the main function

4.Inside the calling function


Question:
Which among the following is correct?

1. Individual data members cant be returned

2.Individual data members can be returned

3.Individual member functions can be returned from another function

4. Individual data members can only be passed by reference


Question:
Which error will be produced if a local object is returned by reference outside a function?

1.Out of memory error

2.Run time error

3. Compile time error

4.No error


Question:
Which is the correct syntax for defining a function which passes an object by reference?

1. className& functionName ( )

2.className* functionName( )

3.className-> functionName( )

4. &className functionName()


Question:
Which is the correct syntax for returning an object by value?

1.void functionName ( ){ }

2.object functionName( ) { }

3.class object functionName( ) { }

4. ClassName functionName ( ){ }


Question:
Why temporary object is not created in return by reference?

1.Because compiler cant create temporary objects

2. Because the temporary object is created within the function

3.Because return by reference just make the objects points to values memory location

4.Because return by reference just make the object point to null


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers – OOPs Basic Concepts
  27. C++ Questions and Answers – Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!