wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Review - Programming in JavaScript

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

What would be the correct way to call a function?

a)

function printPig();

b)

printPig

c)

Print Pig ();

d)

printPig();

2.

console.log involves . . .

a)

asking a question

b)

printing a message

c)

creating a function

d)

calculating a math problem

3.

Ask for a number

a)

let number = readLine

b)

let number = readInteger

c)

let number = readInt

d)

readInt

4.

What would be the correct way to define a function?

a)

function create a fox

b)

function createAFox()

c)

createAFox();

5.

What is the difference between calling and defining a function?

a)

Calling a function is when you give a function a name.
Defining a function is when you determine what is inside that function.

b)

Defining a function is when you determine what a function does.
Calling a function is when you want to use a defined function in your program.

c)

Calling a function is when you determine what a function does.
Defining a function is when you want to use a called function in your program.

6.

Reorder the following to print a message:

a)

console

b)

.

c)

log

d)

("My favorite marvel character is Spiderman.")

e)

;

1)
2)
3)
4)
5)
7.

stores information:

a)

variables

b)

javaScript

c)

user input

d)

functions

8.

Why do we write functions? (select all that apply)

a)
  1. To make our code easier to understand by giving a readable name to a group of instructions

b)
  1. To avoid writing repeated code

c)
  1. To make our code reusable

9.

What keyword do you need to use to define a variable in JavaScript?

a)

variable

b)

var

c)

let

d)

console.log

10.

What is printed to the screen in the program below?

let hobby = "bird watching";

console.log("I like to go " + hobby);

a)
  1. I like to go bird watching

b)
  1. I like to go hobby

c)
  1. I like to go + hobby

d)
  1. “I like to go ” + hobby

11.

Which of the options below is a correct way to declare a variable and assign it a value?

a)

let number = 9;

b)

let number = readInt ("Give me a number.");

c)

let = 9

12.

What function do you need to call to ask the user of the program to enter text?

a)

readText()

b)

readInt()

c)

readline()

d)

readLine()

13.

True or False: the function readInt is asking the user for a number

a)

True

b)

False

14.

True or False:

Calling a function is more work than defining a function

a)

True

b)

False

15.

Which of the words below are Key words? (Select all that apply)

a)

Print

b)

Ask

c)

Calculate

d)

console.log

e)

let

16.

Using User Input, ask the user for their name:

(a)  

17.

Using User Input, ask the user for a number.

(a)  

18.

Using JavaScript, print this message: Ms. Silverman's birthday is on January 21!

(a)  

19.

Using javaScript, create a multiplication problem to calculate the total cost using the variables price and books

(a)  

20.

This code appears at the end of your program and if you delete this, then your function will run but nothing will appear on the screen

a)

function main()

b)

main();