Search Header Logo

KA JS Loops

Computers

KG - University

Used 155+ times

KA JS Loops
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is not a type of loop in JavaScript?

while
for
repeat

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these expressions is NOT a valid way to add 1 to a variable in JavaScript?

x++
x += 1
x = x + 1
x+

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Let's say you have an x variable that starts as 0. If you want your while loop to stop once the x variable equals 400, what condition would you use?

x < 400
x > 400
x == 400
x >= 400

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Let's say you want to repeat a shape 20 times. Which for loop would help you code that?

for (var i = 1; i < 20; i++) { } 
for (var i = 0; i <= 20; i++) { } 
for (var i = 0; i < 20; i++) { } 
for (var i = 0; i > 20; i++) { } 

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Let's say you want to repeat a shape horizontally across the 400x400 canvas, with 40 pixels between each shape. Which for loop would help you code that?

for (var x = 0; x > 400; x += 40) { } 
for (var x = 0; x < 400; x += 40) { } 
for (var x = 0; x < 400; x++) { } 
for (var x = 0; x > 400; x++) { } 

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?