SELENIUM : JAVA : Which loop is guaranteed to execute at least once in Java?

preview_player
Показать описание
SELENIUM : JAVA : Which loop is guaranteed to execute at least once in Java?

SDET Automation Testing Interview Questions & Answers

We will be covering a wide range of topics including QA manual testing, automation testing, Selenium, Java, Jenkins, Cucumber, Maven, and various testing frameworks.

SELENIUM : JAVA : Which loop is guaranteed to execute at least once in Java?

a) for loop
b) while loop
c) do-while loop
d) enhanced for loop

Answer: (c) do-while loop

Explanation: The do-while loop is similar to the while loop, but the condition is checked at the end of the loop instead of the beginning. This means that the loop body is guaranteed to execute at least once, even if the condition is initially false.
Рекомендации по теме
Комментарии
Автор

SELENIUM : JAVA : Which loop is guaranteed to execute at least once in Java?

a) for loop
b) while loop
c) do-while loop
d) enhanced for loop

Answer: (c) do-while loop

Explanation: The do-while loop is similar to the while loop, but the condition is checked at the end of the loop instead of the beginning. This means that the loop body is guaranteed to execute at least once, even if the condition is initially false.

sdet_automation_testing
Автор

do while loop because it will execute first then check condition

PrinceSingh-lvez