100% Pass
What will happen if a loop has no condition and no break statement?
✔✔ It will run indefinitely
Which loop structure is ideal for validating user input until it meets specific criteria?
✔✔ do-while loop
How can a nested loop be terminated early?
✔✔ Using a break statement inside the inner loop
What does a continue statement do inside a for loop?
✔✔ Skips the remaining statements and proceeds to the next iteration
Which loop is generally used when working with an iterator?
✔✔ while loop
1
, What happens if a loop's condition is false at the start in a while loop?
✔✔ The loop does not execute at all
Which loop checks the condition after executing the loop body?
✔✔ do-while loop
What kind of loop is commonly used for iterating over an array without using an index variable?
✔✔ for-each loop
How can you exit multiple nested loops at once?
✔✔ Using labeled break statements
Which type of loop runs faster when iterating through an array?
✔✔ for-each loop
What is the main advantage of a for-each loop?
✔✔ It simplifies iteration by eliminating the need for an index variable
2