1. Which of the following is the correct way to start a C++ program?
2. What is the file extension of a C++ program?
3. Which library is used for input and output in C++?
4. What is the standard namespace in C++?
5. How do you print text in C++?
6. Which symbol is used to end a statement in C++?
7. What does "int" represent in C++?
8. What does the keyword "return" do in a function?
9. What is the output of the following code snippet?
cout << "Hello, World!";
10. Which of the following is a valid C++ comment?
11. What is "cin" used for?
12. How do you declare a variable in C++?
13. Which of the following is NOT a valid data type in C++?
14. What is the default value of an uninitialized variable in C++?
15. Which loop is guaranteed to execute at least once?
16. How do you create a constant in C++?
17. What does "bool" represent in C++?
18. What is the use of the "if" statement in C++?
19. How do you start a block of code in C++?
20. What is the output of the following code snippet?
int x = 5;
cout << x; ans. 5
21. Which header file is essential for input/output operations in C++?
22. What does the following code do?
int arr[5]; ans. integer array of size five
23. Which keyword is used to define a function in C++?
24. What is the output of the following code snippet?
int a = 10, b = 20;
cout << a + b; ans. 30
25. What will the following code produce?
int x = 10;
x++;
cout << x; ans. 11
26. Which keyword is used to allocate memory dynamically in C++?
27. Which of the following is NOT a feature of C++?
28. What symbol is used to declare a pointer in C++?
29. What is the purpose of the "break" statement?
30. What is the output of the following code?
for (int i = 0; i < 3; i++) {
cout << i;
} ans. 012
31. Which of the following is a valid way to declare a string in C++?
32. What keyword is used to create an object in C++?
33. What is the typical size of an "int" variable in most systems?
34. hat does the keyword "class" define in C++?
35. What is the purpose of the "continue" statement in a loop?
36. Which operator is used to access members of a class in C++?
37. How do you write an exception handler in C++?
38. What is the correct syntax for a "for" loop in C++?
39. What is the purpose of the "delete" keyword in C++?
40. What is the purpose of the "private" access specifier in C++?