Sail E0 Webinar

MCQs

Total Questions : 37 | Page 4 of 4 pages
Question 31.

Which of the following statements is correct?

       1. Change a reference changes the referent.

       2. We can create an array of references.


  1.    Only 1 is correct.
  2.    Only 2 is correct.
  3.    Both 1 and 2 are correct.
  4.    Both 1 and 2 are incorrect.
 Discuss Question
Answer: Option A. -> Only 1 is correct.


Question 32.

Which of the following statements is correct?

       1. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.

       2. A reference is not a constant pointer.


  1.    Only 1 is correct.
  2.    Only 2 is correct.
  3.    Both 1 and 2 are correct.
  4.    Both 1 and 2 are incorrect.
 Discuss Question
Answer: Option D. -> Both 1 and 2 are incorrect.


Question 33.

Which of the following statement is correct?


  1.    A reference is stored on heap.
  2.    A reference is stored on stack.
  3.    A reference is stored in a queue.
  4.    A reference is stored in a binary tree.
 Discuss Question
Answer: Option B. -> A reference is stored on stack.


Question 34.

Functions can be declared to return a reference type. There are reasons to make such a 

declaration/Which of the following reasons are correct?

         1. The information being returned is a large enough object that returning a reference is more 

              efficient than returning a copy.

         2. The type of the function must be a R-value.


  1.    Only 1 is correct.
  2.    Only 2 is correct.
  3.    Both 1 and 2 are correct.
  4.    Both 1 and 2 are incorrect.
 Discuss Question
Answer: Option C. -> Both 1 and 2 are correct.


Question 35.

Which reference modifier is used to define reference variable?


  1.    &
  2.    $
  3.    #
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> &

None.


Question 36.

Identify the incorrect statement


  1.    reference is the alternate name of the object
  2.    A reference value once defined can be reassigned
  3.    A reference value once defined cannot be reassigned
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> A reference value once defined can be reassigned

Reference is a thing which points to valid memory address, so it can’t be redesigned.


Question 37.

Which value we cannot assign to reference?


  1.    integer
  2.    floating
  3.    unsigned
  4.    null
 Discuss Question
Answer: Option D. -> null

If it can be assigned with a null value means, it is a copy of pointer.


Latest Videos

Latest Test Papers