C++ MCQ Questions and Answers
C++ MCQ questions and answers are vital for students preparing for software development and IT placement exams like TCS, Infosys, and Tech Mahindra. These questions test your understanding of core concepts such as classes, objects, inheritance, polymorphism, and templates. Practicing C++ programming MCQs with detailed explanations helps strengthen coding logic and syntax understanding. This topic is ideal for candidates aiming to improve their performance in programming interview questions with answers and campus recruitment tests.
C++ MCQ
Showing 10 of
93 questions
31. Regarding following statement which of the statements is true? const int pathwidth=100;
- Declares a variable pathwidth with 100 as its initial value
- Declares a construction pathwidth with 100 as its initial value
- Declares a constant pathwidth whose value will be 100
- Constructs an integer type variable with pathwidth as identifier and 100 as value
32. In an assignment statement
- The lvalue must always be a variable
- The rvalue might be a constant, a variable, an expression or any combination of these
- The assignment always takes place from right to left and never the other way
- All of above
33. In an assignment statement a=b; Which of the following statement is true?
- The variable a and the variable b are equal.
- The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a
- The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a
- The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
34. All of the following are valid expressions in C++ a = 2 + (b = 5); a = b = c = 5; a = 11 % 3
- TRUE
- FALSE
35. To increase the value of c by one which of the following statement is wrong?
- c++;
- c = c + 1;
- c + 1 => c;
- c += 1
36. When following piece of code is executed, what happens? b = 3; a = b++;
- a contains 3 and b contains 4
- a contains 4 and b contains 4
- a contains 4 and b contains 3
- a contains 3 and b contains 3
37. The result of a Relational operation is always
- either True or False
- is less than or is more than
- is equal or less or more
- All of these
39. What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
- 10
- 9
- 0
- 1
40. When does the code block following while(x<100) execute?
- When x is less than one hundred
- When x is greater than one hundred
- When x is equal to one hundred
- While it wishes