wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript Assessment

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What will be the output of the code?

a)

33

b)

2

c)

1

d)

8

2.

What will be the output of the code?

a)

TRUE

b)

FALSE

3.

What will be the output of the code?

a)

NaN

b)

Number

c)

Null

d)

undefined

4.

What will be the output of the code?

a)

TRUE

b)

FALSE

5.

What will be the output of the code?

a)

1

b)

0

c)

"true"

d)

true

6.

What will be the output of the code?

a)

NaN

b)

3

c)

5

d)

13

7.

What will be the output of the code?

a)

1

b)

2

c)

9

d)

undefined

8.

What will be the output of the code?

a)

TRUE

b)

FALSE

9.

What will be the output of the code?

a)

String

b)

Number

c)

1

d)

True

10.

What will be the output of the code?

a)

TRUE

b)

FALSE

11.

If you type the following code in the console window, what result will you get?

3 > 2 > 1 === false;

a)

TRUE

b)

FALSE

12.

Javascript is a _________-side programming language.

a)

Client

b)

Server

c)

Cloud

d)

Personal

13.

Which of the following will write the message “Hello DataFlair!” in an alert box?

a)

alertBox(“Hello DataFlair!”);

b)

alert(Hello DataFlair!);

c)

msgAlert(“Hello DataFlair!”);

d)

alert(“Hello DataFlair!”);

14.

How do you find the minimum of x and y using JavaScript?

a)

min(x,y);

b)

Math.min(x,y)

c)

Math.min(xy)

d)

min(xy);

15.

Which of the following statements will throw an error?

Please select 2 correct answers.

a)

var fun = function bar( ){ }

b)

var fun = function bar{ }

c)

function fun( ){ }

d)

function( ){ }

16.

If the value of x is 40, then what is the output of the following program?

(x % 10 == 0)? console.log(“Divisible by 10”) : console.log(“Not divisible by 10”);

a)

ReferenceError

b)

Divisible by 10

c)

Not divisible by 10

d)

None of the above

17.

Which JavaScript label catches all the values, except for the ones specified?

a)

Catch

b)

Label

c)

Try

d)

Default

18.

Which is the correct “if” statements to execute certain code if “x” is equal to 2?

a)

if(x 2)

b)

if(x = 2)

c)

if(x == 2)

d)

if(x != 2 )

19.

What will the code return?

Boolean(3 < 7)

a)

True

b)

False

c)

NaN

d)

Syntax Error

20.

What is the output of the following code in the console?

var x = 0; function fun(){     ++x;

this.x = x;

return x;

}

var bar = new new fun;

console.log(bar.x);

 

a)

ReferenceError

b)

Undefined

c)

1

d)

TypeError