Which two statements are true?

Given the for loop construct: Which two statements are true?

Given the for loop construct: Which two statements are true?

A.
The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop
begin.

B.
When expr2 evaluates to false, the loop terminates. It is evaluated only after each
iteration through the loop.

C.
The expression expr3 must be present. It is evaluated after each iteration through the
loop.

D.
This is not the only valid for loop construct; there exits another form of for loop
constructor.



Leave a Reply 4

Your email address will not be published. Required fields are marked *


bob

bob

Answers provided are incorrect.
Correct answers are :

A – True
B – False (also evaluated before first iteration)
C – False
D – True (foreach with iterator : for(int i : arrayOfInt )

pojo

pojo

I saw it on site: http://www.tutorialspoint.com/java/java_for_loop.htm
“The Boolean expression is now evaluated again. If it is true, the loop executes and the process repeats (body of loop, then update step, then Boolean expression). After the Boolean expression is false, the for loop terminates.” maybe help you

Roger Wilco

Roger Wilco

A and D are correct answers