C++ MCQ Questions and Answers

Practice Mode
Showing 10 of 93 questions
Q31
Regarding following statement  which of the statements is true?   const int pathwidth=100;
  • A Declares a variable pathwidth with 100 as its initial value
  • B Declares a construction pathwidth with 100 as its initial value
  • C Declares a constant pathwidth whose value will be 100
  • D Constructs an integer type variable with pathwidth as identifier and 100 as value
Answer: Option C
Q32
In an assignment statement
  • A The lvalue must always be a variable
  • B The rvalue might be a constant, a variable, an expression or any combination of these
  • C The assignment always takes place from right to left and never the other way
  • D All of above
Answer: Option D
Q33
In an assignment statement a=b; Which of the following statement is true?
  • A The variable a and the variable b are equal.
  • B The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a
  • C The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a
  • D The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
Answer: Option B
Q34
All of the following are valid expressions in C++ a  =  2 + (b = 5); a  = b = c = 5; a  = 11 % 3
  • A TRUE
  • B FALSE
Answer: Option A
Q35
To increase the value of c by one which of the following statement is wrong?
  • A c++;
  • B c = c + 1;
  • C c + 1 => c;
  • D c += 1
Answer: Option C
Q36
When following piece of code is executed, what happens? b = 3; a = b++;
  • A a contains 3 and b contains 4
  • B a contains 4 and b contains 4
  • C a contains 4 and b contains 3
  • D a contains 3 and b contains 3
Answer: Option A
Q37
The result of a Relational operation is always
  • A either True or False
  • B is less than or is more than
  • C is equal or less or more
  • D All of these
Answer: Option A
Q38
Which of the following is not a valid relational operator?
  • A ==
  • B =>
  • C >=
  • D >=
Answer: Option B
Q39
What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
  • A 10
  • B 9
  • C 0
  • D 1
Answer: Option A
Q40
When does the code block following while(x<100) execute?
  • A When x is less than one hundred
  • B When x is greater than one hundred
  • C When x is equal to one hundred
  • D While it wishes
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test