C++ Programming Multiple Choice Questions - References
This section focuses on the "References" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Reference is like a?
A. Pointer
B. Structure
C. Array
D. None of the above
View Answer
Ans : A
Explanation: Reference is not like Pointer, Structure, Array.
2. A References is :
A. A variable that holds memory address.
B. A Alias to an existing variable.
C. Alias to an existing variable and holds memory address.
D. None of the above
View Answer
Ans : B
Explanation: A References is A Alias to an existing variable.
3. A variable can be declared as reference by putting _______ in the declaration.
A. #
B. $
C. &
D. *
View Answer
4. If a function receives a reference to a variable, can it modify the value of the variable?
A. Yes
B. No
C. We can not pass reference to a variable.
D. Reference can not contain function.
View Answer
Ans : A
Explanation: If a function receives a reference to a variable, it can modify the value of the variable.
5. Through references we can avoid?
A. wastage of memory
B. wastage of CPU time
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: If we pass it without reference, a new copy of it is created which causes wastage of CPU time and memory. We can use references to avoid this.
6. References can be NULL?
A. References has constant value 0.
B. References has constant value .
C. Yes.
D. No.
View Answer
Ans : D
Explanation: References can not be NULL.
7. How many objects reference can refer during its lifetime?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : A
Explanation: reference can refer only one object during its lifetime.
8. Dereference operator is also called as
A. pointer
B. Reference operator
C. Offset operator
D. Deoffset operator
View Answer
Ans : C
Explanation: Dereference operator is also called as Offset operator
9. Which operator is used to de-references to an object?
A. #
B. &
C. *
D. None of the above
View Answer
Ans : D
Explanation: No Operator is used to de-references to an object.
10. Which of the following is an advantage of reference?
A. Safer
B. Easier to use
C. Time consuming
D. Both A and B
View Answer
Ans : D
Explanation: References are safer and easier to use.
Also check :
Discussion