wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Lesson 1

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

JavaScript is standardized under which name?

a)

TypeScript

b)

MACEScript

c)

ECMAScript

d)

JScript

2.

Who created JavaScript?

a)

Bill Gates

b)

Brendan Eich

c)

Elon Musk

d)

Brandon Aich

3.

What is JavaScript mainly used for in creating a web page?

a)

Adding interactivity and logic

b)

Designing page structure

c)

Styling web pages

d)

Creating databases

4.

JavaScript identifiers or names are:

a)

Not case-sensitive

b)

Always written in uppercase

c)

Must start with digits

d)

Case-sensitive

5.

Which of the following identifiers is written in lower camel case?

a)

last_name

b)

LastName

c)

lastName

d)

LASTNAME

6.

Which symbol is used to separate JavaScript statements?

a)

;

b)

.

c)

,

d)

:

7.

Which of the following is NOT a valid way to output data in JavaScript?

a)

.innerText

b)

console.print()

c)

window.alert()

d)

document.write()

8.

Which tag is used to include JavaScript code in HTML?

a)

<style>

b)

<a>

c)

<js>

d)

<script>

9.

Where can you place JavaScript code in an HTML document?

a)

Outside the HTML document

b)

Only in <head>

c)

Either <head> or <body>

d)

Only in <body>

10.

What does the command window.alert("Hello!") do?

a)

Shows a pop-up alert box

b)

Displays text inside an HTML element

c)

Inserts text in the <body>

d)

Prints to the console

11.

Which of the following is NOT allowed in a JavaScript variable name?

a)

name1

b)

nameOne

c)

1name

d)

name_1

12.

How do you write a multi-line comment in JavaScript?

a)

/* comment */

b)

// comment

c)

## comment ##

d)

<!-- comment -->

13.

When was JavaScript created?

a)

1993

b)

1994

c)

1995

d)

1996

14.

A programming language is mainly used to:

a)

Give instructions and logic to the computer

b)

Design the layout of a webpage

c)

Store multimedia content

d)

Style elements on a webpage

15.

document.get (a)   ("demo").innerText = "Hello!"

16.

How do you write a single-line comment in JavaScript?

a)

/* comment */

b)

// comment

c)

## comment ##

d)

<!-- comment -->

17.

What makes JavaScript code easier to read?

a)

Using digits as variable names

b)

Long lines

c)

Adding white space

d)

Removing comments

18.

What are JavaScript instructions called?

a)

Statements

b)

Operators

c)

Elements

d)

Classes

19.

How many statements are there in this line of code?
let x, y, z; x = 1; y = 4; z = x + y;

a)

5

b)

4

c)

3

d)

2

20.

document.getElementById("sample"). (a)   = "Hello!"