
JavaScript Loop Mastery
Authored by Chris Talla
Computers
10th Grade
Used 7+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for a for loop in JavaScript?
for (increment/decrement; condition; initialization) { // code to be executed }
for (initialization; condition; increment/decrement) { // code to be executed }
for (initialization; increment/decrement; condition) { // code to be executed }
for (condition; initialization; increment/decrement) { // code to be executed }
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How is a while loop different from a for loop?
A while loop continues to execute as long as the specified condition is true, whereas a for loop executes a specified number of times.
A while loop and a for loop are essentially the same and can be used interchangeably.
A while loop can only be used for numeric iterations, whereas a for loop can be used for any type of iteration.
A while loop executes a specified number of times, whereas a for loop continues to execute as long as the specified condition is true.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When would you use a do-while loop instead of a while loop?
Use a do-while loop when you want the loop to execute after checking the condition
Use a do-while loop when you want the loop to execute only if the condition is true
Use a do-while loop when you want the loop to execute at least once before checking the condition.
Use a do-while loop when you want to avoid infinite loops
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the concept of nested loops in JavaScript with an example.
Example: for (let i = 0; i < 3; i++) { for (let j = 0; j < 1; j++) { console.log('i:', i, 'j:', j); } }
Example: for (let i = 0; i < 2; i++) { for (let j = 0; j < 3; j++) { console.log('i:', i, 'j:', j); } }
Example: for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { console.log('i:', i, 'j:', j); } }
Example: for (let i = 0; i < 3; i++) { for (let j = 0; j < 2; j++) { console.log('i:', i, 'j:', j); } }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What are the loop control statements available in JavaScript?
break, continue, return
for, while, do-while
if, else, switch
try, catch, finally
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following for loop: for(let i=0; i<5; i++){ console.log(i); }
6
0 1 2 3 4
5
7
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a while loop that prints numbers from 1 to 10.
let i = 1; while (i < 10) { console.log(i); i++; }
let i = 1; while (i <= 10) { console.log(i); i++; }
let i = 1; while (i <= 11) { console.log(i); i++; }
let i = 10; while (i >= 1) { console.log(i); i--; }
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
11 questions
Types of Mass Media
Quiz
•
10th Grade - Professi...
10 questions
Contact Center Sevices
Quiz
•
7th - 10th Grade
8 questions
Basic computer
Quiz
•
9th - 12th Grade
12 questions
OCR Internet Technologies
Quiz
•
10th - 11th Grade
10 questions
Sistema Operativo Android
Quiz
•
9th - 12th Grade
15 questions
MIT APP - QUIZ
Quiz
•
10th Grade
10 questions
Visual Basic 2010
Quiz
•
8th Grade - University
10 questions
S2 Subject Choice Quiz
Quiz
•
8th - 10th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade