wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JAVASCRIPT PART 1

Total questions: 60

Worksheet time: 34mins

Name
Class
Date
1.
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
2.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
3.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
4.
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
5.
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
6.
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
7.
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
8.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
9.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
10.
What surrounds an array?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
11.
What command draws a rectangle?
a)
rec (10, 20, 100, 200);
b)
rect (10, 20, 100, 200)
c)
rect (10, 20, 100, 200);
d)
ellipse (10, 20, 40, 40)
12.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables
13.
JavaScript uses the _______ keyword to define variables.
a)
vrb
b)
var
c)
vari
d)
va
14.

This saves a value, which can be then assigned when writing code

a)

Parameter

b)

Function

c)

Variable

15.

Which of these is a loop?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

16.

Which command provides a random color?

a)

Randomizer.color

b)

Randomizer.nextColor()

c)

RandColor;

d)

nextColor.Randomizer()

17.

Which of these will increase the value of the variable X?

a)

increment (x)

b)

x++;

c)

x=x;

d)

x+1;

18.

Which of the following will decrease the value of x?

a)

x--;

b)

x-1;

c)

x=x;

d)

x=-x;

19.

Greater than or equal to

a)

> or =

b)

> || =

c)

>=

d)

<=

20.

His name is Fred and he is less than 16 years old

a)

if (name = "fred" && age < 16 )

b)

if (name === "fred" && age < 16 )

c)

if (name = "fred" || age < 16 )

d)

if (name === "fred" || age < 16 )

21.

Repeat something 10 times

a)

repeat 10

b)

for (var i=0; i<10; i++)

c)

repeat { } until 10;

d)

while (i = 10)

22.

When we are done with a line what do we put at the end?

a)

a colon :

b)

a semi-colon ;

c)

a period .

d)

a quotation mark "

23.

When we surround a word with quotes "David" it's called ?

a)

a program

b)

a loop

c)

a string

d)

a command

24.

A short form writing the word variable is

a)

rav

b)

VAR

c)

var

d)

varia

25.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
26.
Which keyword do we need to define a function?
a)
function
b)
method
c)
onclick
d)
functionName()
27.
Which 1 of the following symbols is used for JavaScript comments?
a)
\\
b)
^
c)
?
d)
//
28.
What type of variable is
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
29.

How can a developer show a pop-up message to the user?

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

30.

What attribute/value do we use to make a button execute JavaScript when clicked?

a)

onclick="doSomething;"

b)

on-click="doSomething;"

c)

onclick="doSomething();"

d)

onclick=doSomething();

31.
How do I declare a new variable?
a)
var newVariable = 5;
b)
Variable int = new Variable();
c)
var 5 = myVariable;
d)
int var = 5;
32.
What is CSS used for?
a)
styling web pages
b)
formatting script correctly
c)
client side scripting
d)
server side scripting
33.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
34.

Which of the following platform(s) can be used to run Javascript Code

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

Safari

35.
How do I change the size of an image?
a)
width / height
b)
scale
c)
size
d)
shrink
36.

What is the value of:

”41” + 1

a)

42

b)

“42”

c)

411

d)

“411”

37.

JavaScript functions can access variables defined in the same scope?

a)

True

b)

False

38.

Variables defined inside of functions are accessible outside of the function?

a)

True

b)

False

39.

In JavaScript strings must be defined using only double quotes (“).

a)

True

b)

False

40.

Determine what x would be when assignment operators are used given that  ×=6\times=6   y=12y=12   z=18z=18  
x−=3

x%=4

a)

4 and 5

b)

3 and 2

c)

3 and 7

d)

1 and 2

41.

Perform the operation on operands of different data types given that:

a = 4 , b = happy , c= people, d = 9 , e = memories


Solve : a - d

a)

13

b)

5

c)

8

d)

9

42.

Perform the operation on operands of different data types given that a = 4 , b = happy , c= people, d = 9 , e = memories


Solve: b + c

a)

happy people

b)

people happy

c)

happy memories

d)

happy plus

43.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


(x!== 9 && y===16 ) || ( x>10 || y!=16)

a)

False

b)

True

44.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x === 8 || y > 5) && ( x! == 7 && y > "11")

a)

True

b)

False

45.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x > "4" || y<=10) || x === 8|| y>15)

a)

True

b)

False

46.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x > 3 && y ! == 7)&&( x>= 6 && y == 16)

a)

True

b)

False

47.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


!(x=8)

a)

True

b)

False

48.

Determine what result each expression yields if it is True or False. Given that x= 7 and y= 9.


( x >2 && y ! == 9)&&( x>= 6 && y ==9)

a)

True

b)

False

49.

Determine what result each expression yields if it is True or False. Given that x= 5 and y= 3.


( x==2 || y == 3 )||( x<6 && y<9)

a)

True

b)

False

50.

What type of variable is quantites?

var quantities = [2, 4, 10, 1]

a)

string

b)

Boolean

c)

array

d)

number

51.

What type of variable is apple?

var apple = " Fuji "

a)

string

b)

Boolean

c)

array

d)

number

52.

What is first index value of an array?

a)

2

b)

-1

c)

0

d)

1

53.

What will this code display?

a)

8, 2, 1, 4, 7

b)

82147

c)

Myarray.length

d)

5

54.

What will this code display?

a)

Hello Emma

b)

Hello user

c)

Hello+user

d)

nothing

55.

What will this code display?

a)

570

b)

569

c)

568

d)

attendees

56.

Which of these is a method?

a)

getElementById( )

b)

style

c)

document

d)

color

57.

Which line is missing to return the result of the multiplication 10 x 5 ?

a)

result

b)

number 1 * number 2 ;

c)

let result = 10 x 5 ;

d)

var result = number 1 * number 2 ;

58.

Which of these methods removes the last element of an array?

a)

pop( )

b)

splice( );

c)

push( )

d)

split( )

59.

What would this piece of code display?

a)

text

b)

John, Joe, Greg, Ruth

c)

John

Joe

Greg

Ruth

d)

4

60.

What would this piece of code display?

a)

10

20

30

40

b)

1

2

3

4

c)

10

20

30

40

50

d)

11

22

33

44