Page 111 - PortGPT_V2.1_C8_Flipbook
P. 111
test Your skiLLs
1. Tick ( ) the correct option.
a. What does the while loop do?
(i) Repeat a chunk of code a given number of times
(ii) Repeat a chunk of code until a condition is true
(iii) Repeat a chunk of code until a condition is false
(iv) Repeat a chunk of code indefinitely
b. Which of the following skips the execution of the rest of the statements in the loop for the
current iteration?
(i) for statement (ii) while statement
(iii) break statement (iv) continue statement
c. Which of the following statements allow to repeat a task for a fixed number of times?
(i) for statement (ii) while statement
(iii) if…else statement (iv) continue statement
d. Which of the following statements terminates the execution of the loop?
(i) if (ii) for
(iii) break (iv) continue
e. Which of the following is a loop in Java?
(i) for (ii) while
(iii) do-while (iv) All of these
2. Fill in the blanks using the words from the help box.
infinite, break, while, continue, at least once
a. The ____________ statement executes a set of statements repeatedly, until the logical
expression remains true.
b. The do-while loop will execute ____________ even if the text condition is false.
c. The ____________ loop never ends.
d. The ____________ and ____________ are the jump statements in JavaScript.
3. Write 'T' for true and 'F' for false statements.
a. In for loop, i<=10 is known as conditional expression. ___
b. The continue statement breaks one loop at a time. ___
Loops in JavaScript 109

