C++ MCQ Questions with Answers – Part 11
Multiple choice questions and answers (MCQs) on C++ to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as Variables, Operators, Conditional Statement, Functions, and more. This quiz will easily prepare anyone to pass their online test.
1. Identify the type of variables.
typedef char* CHAR; CHAR a,b;
A CHAR*
B CHAR
C char
D char*
2. What is the output of the following C++ code?
#include <iostream> using namespace std; enum letter { A = 20, B, C }; int main() { cout << A << B << C; return 0; }
A 202020
B 202122
C 222120
D None of the above
3. What is the output of the following C++ code?
#include <iostream> using namespace std; enum Jour { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY }; int main() { cout << MONDAY << TUESDAY << WEDNESDAY << THURSDAY << FRIDAY; return 0; }
A 43210
B 01235
C 01234
D 01435
4. What is the output of the following C++ code?
#include <iostream> using namespace std; int main() { int i, j; i = 1; j = (i++, i + 10, 9 + i); cout << j; return 0; }
A 10
B 2
C 11
D 20
5. How many instruction sequences are there in C++?
A 2
B 3
C 4
D 5
6. The goto destination for the label is identified by __
A $
B @
C %
D :
7. What is the output of the following C++ code?
#include <iostream> using namespace std; int main () { int i; for (i = 7; i > 0; i--) { cout << i; if (i == 5) break; } return 0; }
A 76
B 7654
C 765
D 5
8. What is the output of the following C++ code?
#include <iostream> using namespace std; int main() { int x = 2, v; void *p = &x; double y = 3; p = &y; v = x + y; cout << v << ', ' << p; return 0; }
A Display 5, then the memory address
B Displays the memory address
C Display 5
D None of the above
9. How many comment types are there in C++?
A 1
B 2
C 3
D 4
10. What is the output of the following C++ code?
#include <iostream> using namespace std; int main() { int n = 5; for ( ; ;) cout << n; return 0; }
A Error
B 5
C Display 5 infinitely
D None of the above