JavaScript Basics

JavaScript Basics

KG

22 Qs

quiz-placeholder

Similar activities

Scratch

Scratch

3rd Grade

21 Qs

Minecraft

Minecraft

7th Grade

20 Qs

JavaScript and HTML review

JavaScript and HTML review

8th - 10th Grade

20 Qs

Day 3 - Dom Manipulation

Day 3 - Dom Manipulation

Professional Development

20 Qs

AP CSP Exam Reference Sheet Practie

AP CSP Exam Reference Sheet Practie

12th Grade

25 Qs

JS Practice

JS Practice

12th Grade

17 Qs

Week 2 - Assessment 2 (ITNW0223)

Week 2 - Assessment 2 (ITNW0223)

University

20 Qs

CODEHS KAREL

CODEHS KAREL

7th - 9th Grade

20 Qs

JavaScript Basics

JavaScript Basics

Assessment

Quiz

Computers

KG

Hard

Created by

amit Xalxo

Used 13+ times

FREE Resource

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What keyword is used to declare a variable in JavaScript?

var

function

let

const

Answer explanation

The keyword 'let' is used to declare a variable in JavaScript.

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which loop is used to iterate over an array in JavaScript?

while

switch

if

for

Answer explanation

The correct loop used to iterate over an array in JavaScript is the 'for' loop.

3.

MULTIPLE SELECT QUESTION

10 sec • 1 pt

What symbol is used for strict equality comparison in JavaScript?

===

=/=

!==

===

Answer explanation

The symbol used for strict equality comparison in JavaScript is '===' which checks both value and type.

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

How do you write an 'if' statement in JavaScript?

if (condition) // code block

if [condition] { // code block }

if (condition) { // code block }

if (condition) { /* code block */ }

Answer explanation

In JavaScript, the correct way to write an 'if' statement is: if (condition) { // code block }

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the result of 10 + '5' in JavaScript?

501

105

50

15

Answer explanation

In JavaScript, when adding a number to a string, the number is converted to a string and concatenated. Therefore, 10 + '5' results in '105'.

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the purpose of the 'for' loop in JavaScript?

To iterate over a block of code multiple times

To change the font color of a webpage

To calculate complex mathematical equations

To play music in the background

Answer explanation

The 'for' loop in JavaScript is used to iterate over a block of code multiple times, making it the correct choice.

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the syntax for the 'switch' statement in JavaScript?

switch(expression) { case value1: // code block break; case value2: // code block break; ... default: // code block }

switch(expression) { case value1: // code block break; case value2: // code block break; ... default: // code block}

switch(expression) { case value1: // code block break; case value2: // code block break; ... default: // code block

switch{expression} case value1: // code block break; case value2: // code block break; ... default: // code block

Answer explanation

The correct syntax for the 'switch' statement in JavaScript is: switch(expression) { case value1: // code block break; case value2: // code block break; ... default: // code block}

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?