|\ |\ |\ |\ |\ |\
How many iterations (if any)will the following loop make?
|\ |\ |\ |\ |\ |\ |\ |\ |\
for(int a = 0; a < 4; a++) {} - CORRECT ANSWERS ✔✔4
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
How many iterations (if any)will the following loop make?
|\ |\ |\ |\ |\ |\ |\ |\
for(int b = 5; b >= 0; b--) {} - CORRECT ANSWERS ✔✔6
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
How many iterations (if any)will the following loop make?
|\ |\ |\ |\ |\ |\ |\ |\
for(int c = 25; c > 45; c+= 5) {} - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔0
How many iterations (if any)will the following loop make?
|\ |\ |\ |\ |\ |\ |\ |\
for (int d = 0; d <= 17; d += 3) {} - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔6
while (true) {} - CORRECT ANSWERS ✔✔infinite
|\ |\ |\ |\ |\ |\
When is it better or preferable to use a while loop instead
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
of a for loop? - CORRECT ANSWERS ✔✔It is better to use a
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
while loop when the number of iterations is not known in
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
advance, such as when dealing with random numbers or |\ |\ |\ |\ |\ |\ |\ |\ |\
type safe user input.
|\ |\ |\
, When is it better or preferable to use a for loop instead of
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
a while loop? - CORRECT ANSWERS ✔✔It is better to use a
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
for loop when the number of iterations is known in
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
advance, such as when processing Strings, lists, or
|\ |\ |\ |\ |\ |\ |\ |\
dealing with input of a fixed size. |\ |\ |\ |\ |\ |\
Write some selection statements for a number guessing
|\ |\ |\ |\ |\ |\ |\ |\
game that can help determine how a user inputted guess
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
is related to the hidden number. As a part of your solution
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
you can use two int variables with identifiers guess and
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
secretNumber, which you can assume have been |\ |\ |\ |\ |\ |\ |\
previously declared and initialized. Your code should print
|\ |\ |\ |\ |\ |\ |\ |\
out the message "Too high", "Too low", or "Correct" based
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
on how the guess is related to the secret number. You do
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
not need to worry about reading input or handling
|\ |\ |\ |\ |\ |\ |\ |\ |\
multiple guesses. - CORRECT ANSWERS ✔✔if(guess >
|\ |\ |\ |\ |\ |\ |\
secretNumber) { |\
|\ System.out.println("Too high"); |\ |\
}
else if (guess < secretNumber) {
|\ |\ |\ |\ |\
|\ System.out.println("Too low"); |\ |\
}
else { |\
|\ System.out.rpintln("Correct"); |\
}