Loading...

C++ Multiple Choice Questions

Our C++ questions and answers focuses on all areas of C++ programming language covering 100+ topics in C++

C++ Decision making & Loops MCQ | Set 2

C++ Decision making & Loops | Set 2


11. The if...else statement can be replaced by which operator?

a) Bitwise operator
b) Conditional operator
c) Multiplicative operator
d) Addition operator



12. The switch statement is also called as?

a) choosing structure
b) selective structure
c) certain structure
d) bitwise structure



13. Choose a correct C++ for loop syntax.

a) for(initalization; condition; inc/dec){ // statements };
b) for(declaration; condition; incrementoperation){ // statements };
c) for(declaration; incrementoperation; condition){ // statements };
d) for(initalization; condition; incrementoperation){ // statements };



14. Choose a correct C++ do while syntax.

a) dowhile(condition){ // statements };
b) do while(condition){ // statements };
c) do{ // statements }while(condition)
d) do{ // statements }while(condition);



15. Choose a correct C++ Statement.

a) a++ is (a= a+1) POST INCREMENT operator
b) a-- is (a = a-1) POST DECREMENT operator. --a is (a = a-1) PRE DECREMENT operator
c) ++a is (a = a+1) PRE INCREMENT operator
d) All of the above.



16. Which of the following is an entry-controlled loop?

a) For loop
b) while loop
c) do-while loop
d) both b & c



17. Which of the following is an exit-controlled loop?

a) While loop
b) For loop
c) Do while loop
d) both b & c



18. Which of the following is most suitable for a menu-dricen program?

a) For
b) while
c) do-while
d) All of the above



19. Consider the following loop: for(int i = 0; i<5; i++);

a) It will give compilation error.
b) 5
c) 6
d) Some Garbage value



20. A switch construct can be used with which of the following types of variable?

a) int
b) int, char
c) int, float, char
d) Any basic datatype



- Related Topics