wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Javascript

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What will be the output of the following code snippet?

a)

4 10 18

b)

1 2 3

c)

1 4 3

d)

3 4 1

2.

What will be the output of the following code snippet?

a)

3, 4

b)

2, 3

c)

3,4,5

d)

2,3,4

3.

What will be the output of the following code snippet?

a)

47

b)

NaN

c)

0

d)

None of these

4.

 

How do we write a comment in javascript?

a)

/* */

b)

%%

c)

##

d)

&&

5.

_____event gets activated when a component is clicked

a)

onfocus

b)

onblur 

c)

onclick

d)

onerror

6.

What will be the output of the following JavaScript code snippet?

a)

false

b)

true

c)

Compile time error

d)

Run time error

7.

What will be the output of the following JavaScript code snippet?

int a=1;

if(a!=null)

return 1;

else return 0;

a)

0

b)

1

c)

Run time error

d)

compile time error

8.

What happens in the following JavaScript code snippet?

var js = 0;

while (js < 10)

{

console.log(js);

js++;

}

a)

An exception is thrown

b)

The values of js are logged or stored in a particular location or storage

c)

The value of js from 0 to 9 is displayed in the console

d)

An error is displayed

9.

What will be the output of the following JavaScript code?

var quiz=[1,2,3];

var js=[6,7,8];

var result=quiz.concat(js);

document.writeln(result);

a)

1, 2, 3, 6, 7, 8

b)

123

c)

1,2,3

d)

Error

10.

Why event handlers is needed in JS?

a)

Allows JavaScript code to alter the behaviour of windows

b)

Adds innerHTML page to the code

c)

Change the server location

d)

Performs handling of exceptions and occurrences