Exercise: References

Questions for: References

Which of the following statements is correct?
  1. A reference is not a constant pointer.
  2. A referenced is automatically de-referenced.
A:
Only 1 is correct.
B:
Only 2 is correct.
C:
Both 1 and 2 are correct.
D:
Both 1 and 2 are incorrect.
Answer: B
No answer description is available. Let's discuss.
A reference is declared using the _____ symbol.
A:
&&
B:
&
C:
||
D:
!
Answer: B
No answer description is available. Let's discuss.
Which of the following statement is correct about the references?
A:
A reference must always be initialized within functions.
B:
A reference must always be initialized outside all functions.
C:
A reference must always be initialized.
D:
Both A and C.
Answer: C
No answer description is available. Let's discuss.
Which of the following statements is correct?
  1. Change a reference changes the referent.
  2. We can create an array of references.
A:
Only 1 is correct.
B:
Only 2 is correct.
C:
Both 1 and 2 are correct.
D:
Both 1 and 2 are incorrect.
Answer: A
No answer description is available. Let's discuss.
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.
A:
Only 1 is correct.
B:
Only 2 is correct.
C:
Both 1 and 2 are correct.
D:
Both 1 and 2 are incorrect.
Answer: C
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz