Latest Updates :

Wednesday, February 17, 2021

Control Statements C++ MCQ


Control statements are elements in the source code that control the flow of program execution.


1. Which of the following is the scope resolution operator in C++.
A) : :
B) : : *
C) _>*
D) . *
ANS   A   ::
2. . …………….. operator can be used to uncover a hidden variable.
A) pointer-to-member
B) memory release
C) scope resolution
D) line feed
ANS   C

3. ……………………. produce results of type bool which takes a value true or false.
A) Relational expressions
B) Float expressions
C) Logical expressions
D) Bitwise expressions
ANS   A   

4. The ………………… is an entry-enrolled loop. 
A)while
B)IF
C)do-while
D) switch
ANS   A  

5. The ………………….. is an exit-enrolled loop.

A)while
B)for
C) do-while
ANS   C

6. The operator ………………… is known as a compound assignment or short-hand assignment operator.
A) =
B) = =
C) += =
D) +=

ANS   D   +=

7. The switch statement is also called as?
• A. choosing structure
• B. selective structure
• C. certain structure
• D. none of the mentioned

ANS  B

8. The if..else statement can be replaced by which operator?
• A. Bitwise operator
• B. Conditional operator
• C. Multiplicative operator
• D. none of the mentioned

ANS  B

9. The destination statement for the goto label is identified by what label?
• A. $
• B. @
• C. *
• D. :

ANS       D :

10. How many types of loops are there?
• A. 4
• B. 2
• C. 3
• D. 1

ANS C 3

11. Which looping process is best used when the number of iterations is known?
• A. for
• B. while
• C. do-while
• D. all looping processes require that the iterations be known

ANS A for

12. This operator ? : is known as
• A. conditional
• B. relational
• C. casting operator
• D. none of the mentioned
ANS A

13.     ++X is an example of
Post increment
Pre increment
Post decrement
Pre decrement

ANS    Pre increment

14. The CONDITIONAL OPERATOR in C++ is a

Unary operator
Binary operator
Ternary operator

ANS     Ternary operator

15.  The continue statement cannot be used with

A. for
B. while
C. do while
D. switch

Ans : D

Explanation: continue is used to skip the statments and can not be used with switch

16. Switch statement accepts.

A. int
B. char
C. long
D. All of the above

Ans : D

Explanation: switch statment accepts all int , char and long .

17. Which loop is guaranteed to execute at least one time.

A. for
B. while
C. do while
D. None of the above

Ans : C

Explanation: In do while first the statements in the body are executed then the condition is checked. If the condition is true then once again statements in the body of do while are executed.

18. do-while loop terminates when conditional expression returns?

A. One/True
B. Zero/False
C. None of the above

Ans : B

Explanation: zero indicate False which terminate the loop .

19. In the context of "break" and "continue" statements in C++
ANS
"break" and "continue" can be used in "for", "while" and "do-while" loop body. But only "break" can be used in "switch" body.


0 comments:

Post a Comment