Search Header Logo

Javascript basics 8

Authored by Inna .

Professional Development

Professional Development

Used 1+ times

Javascript basics 8
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

What type of loop in JavaScript is used to execute a block of code a specific number of times?

while loop

for loop

if loop

do...while loop

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which loop will always execute the code block at least once?

while loop

for loop

if loop

do...while loop

3.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

In a for loop, which part is optional?

a) Initialization
b) Condition
c) Increment/Decrement
d) All parts are required

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which of the following is the correct syntax for a for loop in JavaScript?

a) for (var i = 0; i < 10; i++)
b) for (i = 0; i < 10; i++)
c) for (var i = 0; i < 10)
d) for i = 0; i < 10; i++

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

What is the purpose of the continue statement in a loop?

a) To terminate the loop immediately
b) To skip the current iteration and move to the next
c) To restart the loop from the beginning
d) To print a message to the console

6.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

How can an infinite loop be created using a for loop?

a) By providing an initial value
b) By not providing an exit condition
c) By using the break statement
d) By using the return statement

7.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

What is the output of the following code snippet?: for (let i = 0; i < 5; i++) { console.log(i); }

a) 0
b) 1
c) 0 1 2 3 4
d) 1 2 3 4

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

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Professional Development