Difficulty: Easy
Correct Answer: Only 1 is correct.
Explanation:
Introduction / Context:
References in C++ act as aliases for existing objects. They are widely used in function parameters, operator overloads, and APIs to avoid copying. This question asks you to judge two statements about reference binding and whether multiple references can refer to the same object.
Given Data / Assumptions:
Concept / Approach:
Statement 1 is true: binding is permanent for a reference. Statement 2 is false: any number of references may be created to the same underlying object. The language does not restrict multiple references; in fact, functions often return or accept references simultaneously, all aliasing the same variable. Therefore, the correct choice is “Only 1 is correct.”
Step-by-Step Solution:
Verification / Alternative check:
Demonstrate with code: create r1 and r2 both referring to x; modifications via either alias are visible via the other, confirming permissibility and aliasing behavior. No rule forbids additional references.
Why Other Options Are Wrong:
Only 2: incorrect because you can create multiple references to one variable.
Both correct: wrong due to statement 2.
Both incorrect: wrong because statement 1 is right.
Common Pitfalls:
Final Answer:
Only 1 is correct.
Discussion & Comments