Programming - Control Statements
You Are Here :: Home > JAVA > Control Statements - General Questions
7.
Which loop executes a block of code or statements till the given condition is true?
A.
While loop
B.
for loop
C.
do-while
D.
none
Answer: Option A
Explanation:
While loop executes a block of code or statements till the given condition is true.
8.
__________ statements:This is another looping statement that tests the given condition past so you can say that the do-while looping statement is a past-test loop statement.
A.
for loop
B.
While loop
C.
do-while loop
D.
both a and b
Answer: Option C
Explanation:
do-while loop statements:This is another looping statement that tests the given condition past so you can say that the do-while looping statement is a past-test loop statement.
9.
which loop is also a loop statement that provides a compact way to iterate over a range of values?
A.
While loop
B.
for loop
C.
do-while loop
D.
none
Answer: Option B
Explanation:
for loop statements:This is also a loop statement that provides a compact way to iterate over a range of values.
10.
Which loop is started with the value specified?
A.
Conditon
B.
increment/decrement operation
C.
both a and b
D.
initialization
Answer: Option D
Explanation:
initialization: The loop is started with the value specified.
11.
_____________ evaluates to either 'true' or 'false'. If it is false then the loop is terminated.
A.
increment/decrement operation
B.
initialization
C.
condition
D.
none
Answer: Option C
Explanation:
condition: It evaluates to either 'true' or 'false'. If it is false then the loop is terminated.
12.
_________________ after each iteration, value increments or decrements.
A.
Conditon
B.
increment or decrement
C.
initialization
D.
both a and b
Answer: Option B
Explanation:
increment or decrement: After each iteration, value increments or decrements.
« prev
next »