wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Quiz 1

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

Which type of JavaScript value is described as having fixed values?

a)

Variables

b)

Functions

c)

Literals

d)

Objects

2.

Which type of JavaScript value is described as having variable values?

a)

Literals

b)

Variables

c)

Constants

d)

Arrays

3.

What is the correct way to declare a constant variable in JavaScript?

a)

let x = 5;

b)

const fname = "John";

c)

var y = 10;

d)

static z = 20;

4.

How does JavaScript interpret the keyword "let"?

a)

It interprets "LET" and "Let" as "let".

b)

It only interprets "let" as "let".

c)

It interprets "LET" as "let".

d)

It interprets "Let" as "let".

5.

What are variables identified with in JavaScript?

a)

Numbers

b)

Unique names called identifiers

c)

Symbols

d)

Reserved words

6.

Why can't reserved words be used as JavaScript identifiers?

a)

They are too long

b)

They are case sensitive

c)

They are JavaScript keywords

d)

They contain special characters

7.

What type of scope do variables declared with 'let' have?

a)

Global Scope

b)

Function Scope

c)

Block Scope

d)

Module Scope

8.

Can variables declared with 'let' be redeclared in the same scope?

a)

Yes, always

b)

No, never

c)

Only in strict mode

d)

Only in non-strict mode

9.

Before ES6, what types of scope did JavaScript have?

a)

A) Block Scope and Global Scope

b)

B) Global Scope and Function Scope

c)

C) Function Scope and Block Scope

d)

D) Block Scope and Local Scope

10.

What happens to variables declared inside a block in JavaScript?

a)

A) They can be accessed from anywhere in the code.

b)

B) They cannot be accessed from outside the block.

c)

C) They are automatically global variables.

d)

D) They are converted to constants.

11.

What scope do variables declared with the 'var' keyword always have?

a)

Local Scope

b)

Block Scope

c)

Global Scope

d)

Function Scope

12.

Can variables declared with the 'var' keyword have block scope?

a)

Yes, always

b)

No, never

c)

Only in functions

d)

Only in loops

13.

What is a key difference between variables declared with "let" and "var"?

a)

Variables with "let" can be redeclared, but "var" cannot.

b)

Variables with "var" can be redeclared, but "let" cannot.

c)

Both "let" and "var" variables can be redeclared.

d)

Neither "let" nor "var" variables can be redeclared.

14.

Which of the following statements is true about variables declared with "let"?

a)

They can be redeclared within the same scope.

b)

They cannot be redeclared within the same scope.

c)

They must be initialized at the time of declaration.

d)

They are function-scoped.

15.

What happens if you try to redeclare a variable using "let" in the same scope?

a)

The variable is overwritten.

b)

An error is thrown.

c)

The variable is ignored.

d)

The variable is automatically converted to "var".

16.

What is a characteristic of variables defined with the 'const' keyword in JavaScript?

a)

They can be redeclared

b)

They can be reassigned

c)

They have block scope

d)

They are automatically global

17.

Which of the following statements is true about 'const' variables in JavaScript?

a)

They can be redeclared in the same scope

b)

They can be reassigned new values

c)

They cannot be reassigned

d)

They are function-scoped

18.

What does the 'Number' data type represent?

a)

A unique and primitive identifier

b)

A data type representing true or false

c)

A number representing a mathematical value

d)

A primitive variable with no assigned value

19.

Which of the following is an example of a String in JavaScript?

a)

let length = 16;

b)

let color = "Yellow";

c)

let x = true;

d)

const cars = ["Saab", "Volvo", "BMW"];

20.

What is the correct way to declare a BigInt in JavaScript?

a)

let x = 1234567890123456789012345n;

b)

let x = "1234567890123456789012345";

c)

let x = 1234567890123456789012345;

d)

let x = BigInt("1234567890123456789012345n");

21.

Which of the following represents a Boolean value in JavaScript?

a)

let x = 1234567890123456789012345n;

b)

let x = true;

c)

const date = new Date("2022-03-25");

d)

const x = Symbol();

22.

What is the correct way to declare a Date object in JavaScript?

a)

const date = new Date("2022-03-25");

b)

let x = null;

c)

const x = Symbol();

d)

let y = false;

23.

What is the purpose of the assignment operator (=) in JavaScript?

a)

To compare two values

b)

To assign values to variables

c)

To perform arithmetic operations

d)

To declare a function

24.

What is a JavaScript expression?

a)

A combination of values, variables, and operators that computes to a value

b)

A function that returns a string

c)

A method to store data in arrays

d)

A way to declare variables

25.

What does the expression (5 + 6) * 10 evaluate to?

a)

50

b)

110

c)

56

d)

60

26.

What will the expression "John" + " " + "Doe" evaluate to?

a)

JohnDoe

b)

John Doe

c)

John + Doe

d)

John " " Doe

27.

What will the expression "5 * 2 + 3" evaluate to?

a)

8

b)

13

c)

10

d)

15

28.

Which of the following statements is true about variables declared with "const"?

a)

They are block-scoped.

b)

They cannot be reassigned after declaration.

c)

They can be reassigned new values.

d)

They can be redeclared in the same scope.

29.

What is the result of the expression "10 / 2 - 1"?

a)

2

b)

4

c)

5

d)

3

30.

What will the expression "true && false" evaluate to?

a)

true

b)

undefined

c)

false

d)

null