wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Basics MCQ Worksheet

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

JavaScript is mainly used for

a)

Styling web pages

b)

Structuring web pages

c)

Making web pages interactive

d)

Creating databases

2.

Which tag is used to write JavaScript in HTML?

a)

<js>

b)

<javascript>

c)

<script>

d)

<code>

3.

Which file extension is used for external JavaScript?

a)

.html

b)

.css

c)

.java

d)

.js

4.

JavaScript is a ______ language.

a)

Case-insensitive

b)

Case-sensitive

c)

Both

d)

None

5.

Which symbol is used for single-line comments in JavaScript?

a)

#

b)

<!-- -->

c)

//

d)

/* */

6.

Which method shows output in a popup box?

a)

console.log()

b)

document.write()

c)

alert()

d)

prompt()

7.

Which keyword is used to declare a constant variable?

a)

var

b)

let

c)

static

d)

const

8.

Which data type stores true or false values?

a)

Number

b)

String

c)

Boolean

d)

Undefined

9.

What is the output of typeof 25?

a)

string

b)

number

c)

boolean

d)

object

10.

Which one is a non-primitive data type?

a)

Number

b)

String

c)

Boolean

d)

Array

11.

Which operator is used to compare both value and data type?

a)

==

b)

=

c)

===

d)

!=

12.

Which loop executes at least once?

a)

for

b)

while

c)

do...while

d)

for...in

13.

Which statement is used to check multiple conditions?

a)

if

b)

if...else

c)

else if

d)

switch

14.

Which keyword stops the loop completely?

a)

stop

b)

exit

c)

break

d)

continue

15.

Which loop is used to iterate an array?

a)

for...in

b)

for...of

c)

while

d)

do...while

16.

Which loop is used to iterate object properties?

a)

for

b)

for...of

c)

for...in

d)

while

17.

Which operator is used for logical AND?

a)

&

b)

||

c)

!

d)

&&

18.

Which statement skips the current loop iteration?

a)

break

b)

continue

c)

return

d)

stop

19.

JavaScript works together with

a)

HTML only

b)

CSS only

c)

HTML and CSS

d)

Java only

20.

In below which represents the OR?

a)

&&

b)

| |

c)

!

d)

&