CPP While Loop MCQ
Cpp MCQ- Home
- Tutorials
- Cpp
- While Loop
- Multiple Choice Question
(1) If condition of while loop remain true for unlimited iterations, then this type of loop is called.
A) Finite loop
B) Infinite loop
C) True loop
D) Power loop
Explanation
If the condition of loop never goes to false then loop iterations will never end. This type of loop are called infinite loop.
(2) The variable used for iterations in condition of while loop is called.
A) Static Variable
B) Counter Variable
C) Inner Variable
D) Condition Variable
Explanation
Counter variable is used to count the iterations in loop. This loop is normally incremented or decremented inside body of loop to repeat statements for specified no of time.
(3) Where increment / decrement statement is written in while statement ?
A) in body of loop
B) out of loop body
C) anywhere in program
D) Noe
Explanation
Increment / decrement statement is always used in body of the loop. If it is used outside of loop body then loop will have no effect of this statement, and loop will become infinite loop.
(4) Which of the following statement is used to print statements in Ascending order using while loop ?
A) Increment
B) Decrement
C) Both
D) None
Explanation
Increment statement is used when we want to print statements in Ascending order. Such as counting, tables and alphabets etc. It is used to increase value of counter variable.
(5) While loop uses which of the following expression as condition ?
A) Relational
B) Logical
C) Arithmetic
D) Both A and B
Explanation
Both arithmetic and logical expression returns TRUE or FALSE. So that both of these can be used as condition.
(6) Which of the following structure is implemented using while statement ?
A) Sequence
B) Selection
C) Iterative
D) Function
Explanation
while statement execute statement or set of statements until given condition remains true. It is loop statement and user to implement iterative structure.