wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript

Total questions: 45

Worksheet time: 23mins

Name
Class
Date
1.

Which are the following are commands, (not variables)?

a)

c.fillStyle = 'green';

b)

color = 'pink';

c)

c.fillRect(50, 120, 10, 300);

d)

drawStackedBoxes(10, 10, 50, 100);

2.

Ah! There's a bug in this command! How should we debug?

c.fillstyle = 'blue';

a)

It should be "blue"

b)

Capitalize the s

c)

Add a space after "c."

d)

Capitalize the f

3.

I need some help assigning the value of 1 to the variable x. What should I do?

a)

1=x;

b)

=1x;

c)

;=x1

d)

x=1;

4.

I used the (a)   analogy to describe what a variable is.

5.

A function is a series of (a)   grouped together.

6.

How many times can I use a function?

a)

1 time

b)

5 times

c)

100 times

d)

Infinite times (there is no limit)

7.

Which of the following contain arguments?

a)

function paintCanvas(color) {

b)

function drawPlayer(x, y) {

c)

drawCanvas();

d)

drawPlayer(150, 20, 'red', 'blue');

8.

Which of the following are examples of User Input?

a)

Key Click

b)

Button Click

c)

Joystick

d)

Eating

9.

Why is the setInterval command useful?

a)

We can loop a block of code infinite times

b)

We create an interval of between the loops

c)

We can tell the functions to run by themselves without calling them

d)

We can automatically assign value to variables

10.

Write any example of an if-else statement! Remember the one I used:


IF you eat all your dinner, then you can have dessert; ELSE (otherwise) you can just sit

here and watch everyone else have dessert.

4 lines
11.

The simplest data-storing structure in any programming language

a)

Lists

b)

Array

c)

Queue

d)

List

12.

A programming language used for webpage functionality such as interactivity, data processing, animation, and development of purpose built apps such as mobile and desktop apps and more.

a)

HTML5

b)

CSS

c)

JS

d)

C#

13.

These are any variable names listed within a function's argument definition.


example: myFunction(x, y)

a)

Parameter

b)

Literals

c)

Constraints

d)

Variables

14.

Which of the following is NOT a valid starting character for JS variable names?

a)

Uppercase Letter

b)

Lowercase Letter

c)

Dollar Sign

d)

Underscore

15.

This allows JS Scripts and applications to perform different actions based on given conditions.

a)

Variables

b)

Loops

c)

Conditional Statement

d)

Stacks

16.

Which of the following is NOT a valid component of a function declaration?

a)

Function keyword

b)

Function name

c)

Pair of Square Braces

d)

Pair of Curly Braces

17.

Which of the following is a symbol that must NOT be present in any JS Variable?

a)

A

b)

z

c)

_

d)

%

18.

A property that contains a function definition.

a)

Object Properties

b)

Object Attributes

c)

Object Methods

d)

Objects

19.

Method used to select the element with a given identifier represented by the HTML element property ID

a)

getElementByClassName() method

b)

getElementById() method

c)

getId()

d)

getElementByTagName()

20.

Which of the following operator is used for the Assignment Operator?

a)

==

b)

!

c)

=

d)

+

21.

Which of the Tag Pair is used to enable JS script writing in HTML?

a)

<br>

b)

<script>

c)

<JS>

d)

<code>

22.

What is the symbol pair used to write a new line within a string values?

a)

\*

b)

\'

c)

\n

d)

\br

23.

in JS, Arrays are considered as what type of programming concept?

a)

Class

b)

Variable

c)

Object

d)

Function

24.

What is the symbol used for the INCREMENT operator in JS?

a)

+

b)

++

c)

=

d)

==

25.

Using object constructors what specific keyword is used to create new object?

a)

if

b)

var

c)

new

d)

this

26.

Which funtion is used when a JS application must ensure that the user gets the information that is displayed?

a)

Alert box

b)

Prompt Box

c)

Combo Box

d)

Confirm Box

27.

Which of the following is NOT a valid keyword for JS

a)

new

b)

switch

c)

synchronize

d)

void

28.

Conditions return values of which data type?

a)

Integer

b)

boolean

c)

floating-point

d)

string

29.

file extension for external JS files

a)

.javascript

b)

.js

c)

.jscript

d)

.script

30.

built in object in JS that allows a script to perform mathematical task

a)

Arithmetic

b)

Math Object

c)

Operation Object

d)

Mathematics Object

31.

used to write comments

a)

++

b)

=

c)

//

d)

--

32.

Which type of array declaration allows for greater simplicity?

a)

Dynamic array

b)

Array Literals

c)

Standar Array Syntax

d)

Specified array declaration

33.

symbol pair used to code backspace within string value

a)

\b

b)

\bspace

c)

\backspace

d)

\n

34.

Since JS functions allow reusability of code, how many times do written codes need too be DEFINED?

a)

TWICE

b)

THRICE

c)

AS MANY AS POSSIBLE

d)

ONCE

35.

HOW MANY CSS PROPERTIES CAN BE SET AND MODIFIED USING JS?

a)

1

b)

HALF OF THE TOTAL NUMBER OF PROPERTIES

c)

NONE

d)

ALL PROPERTIES

36.
A string;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
37.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
38.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
39.
A variable;
a)
Expresses a true false statement
b)
stores a string, number, or boolean, and gives it a specific, case-sensitive name
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
40.
A boolean;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
41.
A function;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
42.
An if/else statement;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
43.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
44.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
45.
What surrounds an array?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets