C++ Quiz
1. What is the correct syntax to include the standard input/output library in C++?
o A) #include <stdlib>
o B) #include <iostream>
o C) #include <stdio.h>
o D) #include <string.h>
2. What is the output of the following code?
cpp
Copy code
#include <iostream>
using namespace std;
int main() {
int x = 5;
int y = 10;
cout << x + y;
return 0;
}
o A) 10
o B) 5
o C) 15
o D) 0
3. Which of the following is used to create a single-line comment in C++?
o A) /* Comment */
o B) // Comment
o C) \* Comment *\
o D) <!-- Comment -->
4. What is the purpose of the namespace keyword in C++?
o A) To define a class
o B) To define a library