wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

Which code fragment sets up a timer that calls a function named "adjust" every second?

a)

setTimeout(adjust, 1);

b)

setTimeout(adjust, 1000);

c)

setInterval(adjust, 1);

d)

setInterval(adjust, 1000);

2.

Which two functions support 2D transformations in CSS3?

a)

skew()

b)

zoom()

c)

move()

d)

scroll()

e)

matrix()

3.

Which three events are valid for the HTML CANVAS element?

a)

scroll

b)

mouseup

c)

blur

d)

datareceived

e)

hover

4.

Which element should you use to rotate an SVG square?

a)

path

b)

ANIMATETRANSFORM

c)

ANIMATEMOTION

d)

AREA SHAPE

5.

When you are working with the path API, what is the purpose of the clip method?

a)

pastes a shape object in from the system clipboard

b)

constrains the rendered output of the shape object

c)

copies the shape object to the system clipboard

d)

stores the shape object for later reference in script

6.

When you are using the GeoLocation API, which two arguments does the getCurrentPosition function utilize?

a)

success callback

b)

MAC address

c)

browser type

d)

ip address

e)

failure callback

7.

Which JavaScript method allows you to register multiple handlers for a single touch event?

a)

dispatchEvent

b)

initUIEvent

c)

addEventListener

d)

initEvent

8.

You need to ensure the scope of a variable named j is limited to the block of a single function named foo(). Which JavaScript code fragment will accomplish this?

a)

function foo(){

var j;

...

}

b)

var j;

function foo() {

....

}

c)

j=0;

function foo () {

...

}

d)

function foo (){

j=0;

...

}

9.

Which two touch gestures require a multi-touch device?

a)

hold

b)

tap

c)

pinch

d)

spread

10.

What value does the following JavaScript code fragment store into the variable num?

a)

maximum length of a character string

b)

potential capacity of local storage

c)

number of bytes available in local storage

d)

number of key-value pairs in local storage

11.

Which JavaScript method is used to draw a circle on a canvas?

a)

ellipse

b)

circle

c)

bezierCurveTo

d)

arc

12.

Which term describes the canvas API?

a)

xml-based

b)

vector-based

c)

retained-mode

d)

immediate-mode

13.

Which two terms represent interfaces in the File API?

a)

Font

b)

Blob

c)

Keygen

d)

FileList

14.

Which three statements describe cookies?

a)

They can be created, read, and erased using the document.cookie property.

b)

They are limited in size to 5 MB.

c)

They are deleted automatically when the session ends.

d)

They can be used only by pages on the domain where they were set.

e)

They contain the data in the form of a name=value pair

15.

Which three properties can be used with the TouchEvent object in the Safari touch API?

a)

offsetTop

b)

clientHeight

c)

scale

d)

touches

e)

rotation

16.

You create an instance named "location" of a geolocation object.
Which code fragment will initiate periodic updates of a device’s geographic location?

a)

location = navigator.geolocation;

b)

location.watchPosition(showLocation) ;

c)

location.getCurrentPosition(showLocation);

d)

location.clearNatch(watchid);

17.

You need to use JavaScript to access the "section1" element in the following code fragment:
<div id=’section1′>
Which method should you use?

a)

getElementsByTagName

b)

getElementById

c)

getElementsByName

d)

getElementsByClassName

18.

Which two code segments declare JavaScript functions? (Choose two.)

a)

varfunct= (a);

b)

function Foo(a){

}

c)

var a=new Foo();

d)

Foo=function(a){…}

19.

On a Windows touch device, which gesture serves the same purpose as a right-click of the mouse?

a)

swipe

b)

pinch

c)

tap

d)

hold

20.

Which three technologies does HTML5 encompass?

a)

CSS

b)

ASP.NET

c)

C#

d)

JavaScript

e)

HTML