Search Header Logo

JavaScript Test 1

Authored by Ryan Valles

Computers

9th - 12th Grade

Used 1+ times

JavaScript Test 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

23 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What function in JavaScript is used to prompt the user for input?

input()

prompt()

ask()

getInput()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the value null represent in JavaScript?

A defined variable.

An undefined variable.

A boolean value.

A nullified function.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to concatenate strings in JavaScript?

+

-

*

/

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an if statement do in JavaScript?

Executes a block of code repeatedly.

Executes a block of code only if a specified condition is true.

Terminates the program.

Declares variables.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

A while loop requires a counter variable.

A for loop cannot contain conditions.

A while loop executes a block of code while a condition is true, without an explicit counter.

A for loop is more efficient for iterating over arrays.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to add alternative code to an if statement, to be executed if the condition is false?

else

and

or

then

7.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Which of the following is a valid JavaScript variable name?

2ndVariable

_variable

$variableName

variable name

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?