lunedì 1 aprile 2013

Q111

Given the for loop construct:
for ( expr1 ; expr2 ; expr3 ) {
statement;
}
Which two statement are true
A.
This is not the only valid for loop construct; there exits another form of for loop constructor.
B.
The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin.
C.
When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop.
D.
The expression expr3 must be present. It is evaluated after each iteration through the loop.
Risposta: A e B.
Infatti esiste il costrutto enhanced for loop e l’espressione 1 è opzionale (come anche la 3,quindi la D è falsa).
La C è falsa perché il controllo viene fatto prima di un ciclo e non dopo.

Nessun commento:

Posta un commento