MCQOPTIONS
Saved Bookmarks
This section includes 14 Mcqs, each offering curated multiple-choice questions to sharpen your Cpp Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What happens when delete is used for a NULL pointer? |
| A. | Compiler Error |
| B. | Run-time Crash |
| C. | No Error |
| D. | None |
| Answer» D. None | |
| 2. |
Which of the following is true about new when compared with malloc: |
| A. | 1 and 3 |
| B. | 2 and 3 |
| C. | 1 and 2 |
| D. | All 1, 2 and 3 |
| Answer» E. | |
| 3. |
Output of the program? |
| A. | 10 |
| B. | 0 |
| C. | 20 |
| D. | Compiler Error |
| Answer» E. | |
| 4. |
Which of the following is true about templates? |
| A. | 1 and 2 |
| B. | 1, 2 and 3 |
| C. | 1, 2 and 4 |
| D. | 1, 2, 3 and 4 |
| Answer» E. | |
| 5. |
In C++, const qualifier can be applied to |
| A. | Only 1, 2 and 3 |
| B. | Only 1, 2 and 4 |
| C. | All |
| D. | Only 1, 3 and 4 |
| Answer» D. Only 1, 3 and 4 | |
| 6. |
Is it fine to call delete twice for a pointer? |
| A. | Yes |
| B. | No |
| C. | none |
| D. | all |
| Answer» C. none | |
| 7. |
Predict the output? |
| A. | Compiler Error |
| B. | 5 |
| C. | Garbage Value |
| Answer» B. 5 | |
| 8. |
Which of the following is incorrect in C++? |
| A. | (1) and (2) |
| B. | (1), (2) and (3) |
| C. | (3) and (4) |
| D. | All are correct. |
| Answer» E. | |
| 9. |
Which of the following is true about pure virtual functions? |
| A. | Both 1 and 2 |
| B. | Only 1 |
| C. | Only 2 |
| D. | Neither 1 nor 2 |
| Answer» D. Neither 1 nor 2 | |
| 10. |
Which of the following is true about constructors? |
| A. | All 1, 2, and 3 |
| B. | Only 1 and 3 |
| C. | Only 1 and 2 |
| D. | Only 2 and 3 |
| Answer» C. Only 1 and 2 | |
| 11. |
class Test { |
| A. | 0 |
| B. | Garbage Value |
| C. | Compiler Error |
| D. | None |
| Answer» D. None | |
| 12. |
#include |
| A. | Compiler Error |
| B. | Constructor called Constructor called |
| C. | Constructor called |
| D. | None of the above |
| Answer» D. None of the above | |
| 13. |
Output of following C++ program? |
| A. | x = 20; ref = 30 |
| B. | x = 20; ref = 20 |
| C. | x = 10; ref = 30 |
| D. | x = 30; ref = 30 |
| Answer» B. x = 20; ref = 20 | |
| 14. |
Predict the output of following C++ program. |
| A. | A non-zero value |
| B. | 0 |
| C. | Compiler Error |
| D. | Runtime Error |
| Answer» B. 0 | |