Solved

Which Statement Is Correct About the Execution of the Loop

Question 73

Multiple Choice

Which statement is correct about the execution of the loop in the following code fragment? double num;
Int incr = 0;
Scanner reader = new Scanner(System.in) ;
Do
{
Incr = incr + 1;
System.out.println("Please enter a number (0 when done) : ") ;
Num = reader.nextDouble() ;
}
While (num != 0) ;
System.out.println("" + incr) ;


A) The loop will execute only when 0 is entered.
B) The execution of the loop is independent of user input.
C) The program prints the count of positive inputs.
D) The loop will execute at least once even if the user has entered the sentinel value.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions