Mastering JavaScript Control Structures

Mastering JavaScript Control Structures

10th Grade

20 Qs

quiz-placeholder

Similar activities

TEST1.PY

TEST1.PY

10th Grade - University

20 Qs

Berpikir Komputasional

Berpikir Komputasional

9th - 12th Grade

20 Qs

Parcial - Módulo IV

Parcial - Módulo IV

1st Grade - University

15 Qs

FNaF1

FNaF1

4th - 12th Grade

19 Qs

ON TAP TIN 11

ON TAP TIN 11

1st - 12th Grade

20 Qs

Cuarto Bach. III U/Final

Cuarto Bach. III U/Final

10th Grade

20 Qs

Q1 W1 M1 PRE-TEST

Q1 W1 M1 PRE-TEST

10th Grade

15 Qs

3rd week g9 summative

3rd week g9 summative

7th - 12th Grade

15 Qs

Mastering JavaScript Control Structures

Mastering JavaScript Control Structures

Assessment

Quiz

Computers

10th Grade

Practice Problem

Medium

Created by

Tarik Sulić

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the basic syntax of a for loop in JavaScript?

for (initialization; increment) // code to be executed

for (increment; condition) { // code }

for (condition; initialization; increment) { // code }

for (initialization; condition; increment) { // code to be executed }

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you declare a variable in a for loop?

You declare a variable in a for loop with 'assign'.

You declare a variable in a for loop using 'declare'.

You declare a variable in a for loop using 'let', 'const', or 'var'.

You declare a variable in a for loop using 'define'.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the initialization statement in a for loop?

To determine the number of iterations in the loop.

To execute the loop body only once.

To increment the loop control variable after each iteration.

To set the initial value of the loop control variable.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the difference between a for loop and a while loop?

A for loop iterates a known number of times, while a while loop continues until a condition is false.

A for loop is used for conditional statements, while a while loop is used for iteration.

A for loop runs indefinitely, while a while loop stops after a set number of iterations.

A for loop can only be used with arrays, while a while loop can be used with any data type.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Provide an example of a while loop that counts from 1 to 5.

i = 1 while i <= 5: print(i) i += 1

i = 1 while i < 5: print(i) i += 1

i = 0 while i <= 5: print(i) i += 1

i = 1 while i < 6: print(i) i += 2

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will happen if the condition in a while loop is always true?

The loop will run a fixed number of times.

The program will skip the loop entirely.

The program will enter an infinite loop.

The program will terminate immediately.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you write an if statement to check if a number is positive?

if (number > 0) { /* code to execute if number is positive */ }

if (number < 0) { /* code to execute if number is negative */ }

if (number == 0) { /* code to execute if number is zero */ }

if (number >= 0) { /* code to execute if number is non-negative */ }

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?