Which of the following is true with respect to Reference?

2014

Which of the following is true with respect to Reference?

  1. A.

    A reference can never be NULL

  2. B.

    A reference needs an explicit dereferencing mechanism

  3. C.

    A reference can be reassigned after it is established

  4. D.

    A reference and pointer are synonymous

Attempted by 113 students.

Show answer & explanation

Correct answer: A

In C++, a reference is an alias for an existing object and must be initialized upon declaration. Unlike pointers, references cannot be null or reassigned to refer to a different object after initialization. Therefore, the statement that a reference can never be NULL is true.

Explore the full course: Isro