

MCQOPTIONS
Saved Bookmarks
This section includes 48 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
What is the output of this program?
|
A. | 2 |
B. | 4 |
C. | 6 |
D. | 8 |
E. | Depends on compiler |
Answer» B. 4 | |
2. |
What is the output of this program?
|
A. | Interview |
B. | Mania |
C. | Interview Mania |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
3. |
What is the output of this program?
|
A. | 12 |
B. | 11 |
C. | Garbage value |
D. | Compilation Error |
E. | Runtime Error |
Answer» B. 11 | |
4. |
What is the output of this program?
|
A. | In swap 11 15 |
B. | In main 11 15 |
C. | Compilation Error |
D. | Runtime Error |
E. | In swap 11 15 In main 11 15 |
Answer» F. | |
5. |
What is the output of this program?
|
A. | 0 |
B. | 12 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» C. Compilation Error | |
6. |
What is the output of this program?
|
A. | 200 200 |
B. | 100 100 |
C. | 150 150 |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
7. |
Which of the following statements is correct?Pointer to a reference and reference to a pointer both are valid.When we use reference, we are actually referring to a referent. |
A. | Only 2 is correct. |
B. | Only 1 is correct. |
C. | Both 1 and 2 are incorrect. |
D. | Both 1 and 2 are correct. |
Answer» E. | |
8. |
Which of the following statements is correct?Change a reference changes the referent.We can create an array of references. |
A. | Only 2 is correct. |
B. | Only 1 is correct. |
C. | Both 1 and 2 are incorrect. |
D. | Both 1 and 2 are correct. |
Answer» C. Both 1 and 2 are incorrect. | |
9. |
Which of the following statements is correct?A reference is not a constant pointer.A referenced is automatically de-referenced. |
A. | Only 2 is correct. |
B. | Only 1 is correct. |
C. | Both 1 and 2 are incorrect. |
D. | Both 1 and 2 are correct |
Answer» B. Only 1 is correct. | |
10. |
Which of the following statements is correct?Once the variable and the reference are linked they are tied together.Once the reference of a variable is declared another reference of that variable is not allowed. |
A. | Only 2 is correct. |
B. | Only 1 is correct. |
C. | Both 1 and 2 are incorrect. |
D. | Both 1 and 2 are correct. |
Answer» C. Both 1 and 2 are incorrect. | |
11. |
Which of the following statements is correct?Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.A reference is not a constant pointer. |
A. | Only 2 is correct. |
B. | Only 1 is correct. |
C. | Both 1 and 2 are incorrect. |
D. | Both 1 and 2 are correct. |
Answer» D. Both 1 and 2 are correct. | |
12. |
Which of the following statement is correct about the program given below? |
A. | The program will print the output 10 21. |
B. | The program will print the output 10 20. |
C. | The program will print the output 11 21 |
D. | The program will print the output 11 20. |
Answer» C. The program will print the output 11 21 | |
13. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print output 3 7. |
B. | The program will print output 4 8. |
C. | The program will print output 5 9. |
D. | The program will print output 6 10. |
Answer» E. | |
14. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 1 2 3 4 5. |
B. | The program will print the output 2 4 6 8 10. |
C. | The program will print the output 1 1 1 1 1. |
D. | It will result in a compile time error. |
Answer» E. | |
15. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 100 10. |
B. | The program will print the output 100 100. |
C. | The program will print the output 100 garbage. |
D. | The program will print two garbage values. |
Answer» C. The program will print the output 100 garbage. | |
16. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 10 10. |
B. | The program will print the output 10 11. |
C. | The program will print the output 11 11. |
D. | The program will print the output 11 10. |
Answer» C. The program will print the output 11 11. | |
17. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print output 2 6. |
B. | The program will print output 3 7. |
C. | The program will print output 4 8. |
D. | The program will print output 5 9. |
Answer» D. The program will print output 5 9. | |
18. |
What will be the output of the following program?
#include
|
A. | 10 20 |
B. | 11 21 |
C. | Garbage Garbage |
D. | It will result in a compile time error. |
Answer» C. Garbage Garbage | |
19. |
What will be the output of the program given below?
#include
|
A. | 0 |
B. | 10 |
C. | 20 |
D. | Garbage-value |
Answer» D. Garbage-value | |
20. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 5 6 7 8 9 10. |
B. | The program will print the output 5 6 7 8 9 10 7. |
C. | The program will print the output 5 7. |
D. | It will result in a compile time error. |
Answer» D. It will result in a compile time error. | |
21. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 0 0 10. |
B. | The program will print the output 10 20 10. |
C. | The program will print the output 10 20 9. |
D. | It will result in a compile time error. |
Answer» C. The program will print the output 10 20 9. | |
22. |
Which of the following statement is correct about the program given below?
#include
|
A. | It will result in a runtime error. |
B. | It will result in a compile time error. |
C. | The program will print the output 9 4. |
D. | The program will print the output 100 100. |
Answer» E. | |
23. |
Which of the following statement is correct about the program given below?
#include
|
A. | It will result in a compile time error. |
B. | The program will print the output 10 20. |
C. | The program will print two garbage values. |
D. | The program will print the address of variable x1 and y1. |
Answer» C. The program will print two garbage values. | |
24. |
Which of the following statement is correct about the program given below?
#include
|
A. | It will result in a compile time error. |
B. | The program will print the output 5 5 5 8. |
C. | The program will print the output 5 5 8 8. |
D. | The program will print the output 5 5 5 5. |
Answer» D. The program will print the output 5 5 5 5. | |
25. |
Which of the following statement is correct about the program given below?
#include
|
A. | It will result in a compile time error. |
B. | The program will print the output 64 9. |
C. | The program will print the output 64 10. |
D. | The program will print the output 64 11. |
Answer» E. | |
26. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 5 6 10. |
B. | The program will print the output 6 6 10. |
C. | The program will print the output 6 6 12. |
D. | It will result in a compile time error. |
Answer» C. The program will print the output 6 6 12. | |
27. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 10 10. |
B. | The program will print the output 10 11. |
C. | The program will print the output 11 10. |
D. | The program will print the output 11 11. |
Answer» E. | |
28. |
What will be the output of the following program?
#include
|
A. | 2 3 6 |
B. | 4 4 7 |
C. | 4 5 8 |
D. | 3 4 6 |
Answer» C. 4 5 8 | |
29. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 50 50. |
B. | The program will print the two garbage values. |
C. | It will result in a compile time error. |
D. | The program will print nothing. |
Answer» E. | |
30. |
Reference is like a _____. |
A. | Pointer |
B. | Structure |
C. | Macro |
D. | Enum |
Answer» B. Structure | |
31. |
Which of the following statements is correct? An array of references is acceptable. We can also create a reference to a reference. |
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» E. | |
32. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 1 2 3. |
B. | The program will print the output 2 3 4. |
C. | The program will print the output 0 1 2. |
D. | It will result in a compile time error. |
Answer» E. | |
33. |
Which of the following statements is correct? Pointer to a reference and reference to a pointer both are valid. When we use reference, we are actually referring to a referent. |
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» D. Both 1 and 2 are incorrect. | |
34. |
Which of the following statements is correct? A reference is not a constant pointer. 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» C. Both 1 and 2 are correct. | |
35. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 10 20. |
B. | The program will print the output 10 21. |
C. | The program will print the output 11 20. |
D. | The program will print the output 11 21. |
Answer» C. The program will print the output 11 20. | |
36. |
Which of the following statement is correct about the program given below?
#include
|
A. | It will result in a compile time error. |
B. | The program will print the output 1. |
C. | The program will print the output 2. |
D. | The program will print the output 3. |
Answer» D. The program will print the output 3. | |
37. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 25 49. |
B. | It will result in a compile time error. |
C. | The program will print the output 50 50. |
D. | The program will print the output 49 49. |
Answer» E. | |
38. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 11 12. |
B. | The program will print the output 12 11. |
C. | The program will print the output 12 13. |
D. | It will result in a compile time error. |
Answer» C. The program will print the output 12 13. | |
39. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 0 11 21. |
B. | The program will print the output 10 11 11. |
C. | The program will print the output 10 11 21. |
D. | The program will print the output 10 11 12. |
Answer» C. The program will print the output 10 11 21. | |
40. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 80 80. |
B. | The program will print the output 81 80. |
C. | The program will print the output 81 81. |
D. | It will result in a compile time error. |
Answer» B. The program will print the output 81 80. | |
41. |
Which of the following statements is correct? We can return a global variable by reference. We cannot return a local variable by reference. |
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. Both 1 and 2 are correct. | |
42. |
A reference is declared using the _____ symbol. |
A. | && |
B. | & |
C. | || |
D. | ! |
Answer» C. || | |
43. |
Which of the following statements is correct? Once a reference variable has been defined to refer to a particular variable it can refer to any other variable. A reference is not a constant pointer. |
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» E. | |
44. |
Which of the following statements is correct? Change a reference changes the referent. 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» B. Only 2 is correct. | |
45. |
Functions can be declared to return a reference type. There are reasons to make such a declaration/Which of the following reasons are correct? The information being returned is a large enough object that returning a reference is more efficient than returning a copy. 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» D. Both 1 and 2 are incorrect. | |
46. |
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» D. Both A and C. | |
47. |
Which of the following statements is correct? Once the variable and the reference are linked they are tied together. Once the reference of a variable is declared another reference of that variable is not allowed. |
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. Only 2 is correct. | |
48. |
Which of the following statement is correct about the program given below?
#include
|
A. | The program will print the output 80 80. |
B. | The program will print the output 81 80. |
C. | The program will print the output 81 81. |
D. | It will result in a compile time error. |
Answer» E. | |