Difficulty: Easy
Correct Answer: Only 2 is correct.
Explanation:
Introduction / Context:
This question checks nuanced type-formation rules and semantics for references. It asks whether you can form a pointer-to-reference type and whether a reference name denotes the underlying object directly in expressions. Understanding these points helps avoid invalid type declarations and improves API design.
Given Data / Assumptions:
Concept / Approach:
A “pointer to a reference” is ill-formed, because references do not exist as independent objects to which you can point. However, a “reference to a pointer” is valid; for example, int* p; int*& rp = p; binds a reference to a pointer variable. Separately, when you use a reference in an expression, the language automatically treats it as the referred-to object. Hence, statement 2 is true, but statement 1 is false because half of its conjunction (“pointer to a reference”) is invalid.
Step-by-Step Solution:
Verification / Alternative check:
Compilation check: int& *pp; is rejected; int*& rp = p; is accepted. Using rp in expressions behaves exactly like using p, confirming “refer to the referent.”
Why Other Options Are Wrong:
Only 1 — wrong because pointer-to-reference is not a legal type.
Both correct — wrong because claim 1 is half-invalid.
Both incorrect — wrong because claim 2 is valid.
Common Pitfalls:
Final Answer:
Only 2 is correct.
Discussion & Comments