wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz3

Total questions: 15

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following represents control flow statements in js ?

a)

simple if

if else

else if ladder

switch

b)

simple if

if else

nested if

if-elif-else

c)

simple if

if-elif-else

switch

d)

None of the above

2.

Which of these belong to looping statements in JS ?

a)

for

b)

for in

c)

for of

d)

for else

3.

Find the output of the following code snippet?

<script>

var a=[1.1,2,5,'gec',99.5,'it'];

for(var x in a)

document.write(x+" "); //output1

for(var x of a)

document.write(x+" "); //output2

</script>

a)

1.1 2 5 gec 99.5 it

0 1 2 3 4 5

b)

1.1 2 5 gec 99.5 it

0 1 1 2 3 4

c)

0 1 2 3 4 5

1.1 2 5 gec 99.5 it

d)

0 1 2 3 4 5

1,1 2 5 gec 99.5 it

4.

Which keyword is used to create functions in Javascript ?

a)

def

b)

define

c)

func

d)

function

5.

 

Guess the Output for the following code snippet ?

<html>

<script>

function reverse(x){

var s=0;

while(x>0){

s=s*10+x%10;

x=x/10;

}

return s;

}

document.write("Reverse is: "+reverse(123));

</script>

</html>

a)

Reverse is: NaN

b)

Reverse is: 321.000

c)

Reverse is: Infinity

d)

Reverse is: undefined

e)

Reverse is: 321

6.

What is abbrevation of DOM ?

a)

Domain Object Model

b)

Document Object Model

c)

Discriptive Oreintation Model

d)

Discriptive Object Model

7.

<html>

<script>

var x=" 68.3";

var b=Number(x);

var a=parseInt(x);

document.write(b+" ");

document.write(a);

</script>

</html>

Predict the Output ?

a)

68 68.3

b)

68.3 68

c)

68 68

d)

68.3 68.3

8.

Which of the following are commonly used mouse events in html ?

a)

mouseClick

b)

mouseEntered

c)

onsubmit

d)

onclick

e)

onchange

9.

Which of the following is correct syntax for getting element by using class ?

a)

getElementByClassName("name")[index]

b)

getelementsByClassName("name")[index]

c)

getElementByClassName[index]("name")

d)

getElementsByClassName("name")[index]

10.

Which of the following statements are correct ?

AThe innerHTML returns the content of the element ,

including spacing and all inner html tags.

BThe innertext not only return just the text content of the element,

it also returns the CSS hidden text spacing and tags,except

<script> and <style> elements

C. setAttribute() method is used to dynamically change the html tag attribute.

D. value attribute is used to assign some value ,it is not used to

reset the html element

a)

A,B,C

b)

A,D

c)

B,C,D

d)

A,C

11.

Regular Expression always starts with symbol ?

a)

*

b)

#

c)

/

d)

[

12.

<html>

<script>

var a=/\d{4}/;

var b="abc,234,2875,46678,sjgd";

var x=/\d{4}/g;

var y="abc,234,2875,46678,sjgd";

document.write(b.match(a)); //o/p1

alert(y.match(x)); //o/p2

</script>

</html>

a)

o/p1 : 2875,4667

o/p2 : 2875,4667

b)

o/p1 : 2875

o/p2 : 2875,4667

c)

o/p1 : 2875,4667

o/p2 : 2875

d)

none

13.

Predict the Output?

<html>

<script>

var a=[3,4,5];

var b=[8,56,14];

var c=a.concat(b)

c.splice(3,2)

document.write(c);

</script>

</html>

a)

3,4,5,14

b)

3,4,5,8

c)

5,8,56,14

d)

3,4,5,56

14.

<html><script>

var a=" Hakuna Matatajgsw ";

document.write(a.slice(1,14));

</script></html>

What will be the Output ?

a)

Syntax error

b)

Hakuna Matata

c)

Hakuna Matatajg

d)

compilation failed

15.

which of the following statements are incorrect ?

i. jQuery is a javascript library .

ii. jQuery functions are Anonymous functions

iii.jQuery functions doesn't contain any document selectors .

iV.We can run jQuery in our system any time ,without considering any internet connection.

a)

i,ii,iii

b)

ii,iv

c)

i,iii

d)

iii,iv