CS201: Introduction to Programming Using C++
50 Multiple Choice Questions (MCQs) for Virtual University Students
Test Your C++ Programming Skills with These MCQs
-
Which of the following is the correct way to start a C++ program?
-
What is the output of the following code?
cout << "Hello, VU!";
-
Which data type is used to store whole numbers in C++?
-
What symbol is used to end a statement in C++?
-
Which of the following is a valid variable name in C++?
-
What is the size of
int
data type in most systems? -
How do you declare a constant value in C++?
-
What does
cin
do in C++? -
Which operator is used for addition in C++?
-
Which keyword is used to create a loop that executes at least once?
-
What will be the output of the following code snippet?
int x = 5; cout << ++x;
-
Which of these is the correct syntax to declare an array?
-
What is the default access specifier for members of a class in C++?
-
What does the
return 0;
statement signify in the main function? -
Which header file is required to use
cout
andcin
? -
What is the output of:
cout << 10 / 4;
-
What does the following code do?
for(int i=0; i<5; i++) { cout << i << " "; }
-
What is a pointer in C++?
-
How do you comment a single line in C++?
-
Which of the following is the correct way to define a function in C++?
-
What is the output of:
char ch = 'A'; cout << ch;
-
Which of the following operators is used to access members of a class?
-
Which of the following is true about constructors in C++?
-
Which loop is best suited for iterating over a known number of times?
-
What will be the output of the code?
int a = 10, b = 20; cout << (a > b ? a : b);
-
Which of these is a valid Boolean value in C++?
-
How do you dynamically allocate memory for an integer in C++?
-
Which keyword is used to inherit a class?
-
What is the scope resolution operator in C++?
-
What does the following code snippet print?
int x = 5; cout << x--;
-
Which of the following correctly declares a string variable in C++?
-
What is the purpose of the
break
statement? -
What will be the output of:
cout << (5 == 5);
-
Which keyword is used to define a class in C++?
-
Which operator is used for logical AND in C++?
-
How many times will the loop run?
for(int i=0; i<3; i++) { cout << i; }
-
Which of the following is NOT a valid identifier in C++?
-
What is the output of:
cout << sizeof(char);
-
Which of the following is used to define a macro in C++?
-
What is the correct way to start the main function in C++?
-
Which of the following is used to stop a loop from executing?
-
Which keyword allows a function to be called recursively?
-
Which of the following is a way to allocate memory dynamically?
-
Which of these is used for input stream in C++?
-
What is the output of:
cout << (7 % 3);
-
Which operator is used for not equal comparison?
-
Which of these is the correct way to declare a pointer?
-
Which function is used to deallocate memory allocated by new?
-
Which of these is NOT a loop construct in C++?
-
What does the keyword
void
signify? -
Which of the following is correct to print a newline in C++?
-
What does
sizeof
operator return? -
Which of the following is NOT a valid access specifier?
-
Which function is the entry point for all C++ programs?
-
Which of the following is used to terminate a function and return control?
-
Which of the following is the correct way to declare a 2D array?
-
Which of the following keywords is used for exception handling?
-
Which of the following correctly initializes a vector in C++ STL?
-
Which operator is used to get the address of a variable?
-
What is the output of:
cout << (10 / 3);
0 Comments