Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Code.org Coding Lessons 4-6

Total questions: 10

Worksheet time: 13mins

Name
Class
Date
1.
Two different functions in a program could contain the same code (accomplish the same task)
a)
True
b)
False
2.
Which of the following is true regarding naming functions? 
a)
Function names can be reused multiple times
b)
A function name should be as descriptive as possible to indicate what the function does.
c)
Function names should be organized alphabetically
d)
The function name should begin with a number that indicates the order in which it should be executed.
3.

What is the correct format to define a function?

Note: The name of the Function is "multiplyBy2"

a)

multiplyBy2();

b)

function multiplyBy2(){

//steps to execute function

}

c)

function multiplyBy2

d)

multiplyBy2{5}{

//steps of function

}

4.
What is the correct way to call the function called "doMath" with a parameter of 5?
a)
doMath(5);
b)
function doMath(5);
c)
doMath();
d)
doMath{5};
5.
Which of the following commands will move the turtle forward one unit?
a)
move
b)
move;
c)
move();
d)
move()
6.

What makes the following command invalid: turnleft();

a)

It should end in a colon rather than a semicolon

b)

The letter l should be capitalized - L

c)

It should start with a capital T

d)

The command is correct

7.

Why do we use functions in programs?

a)

A. Make the program easier to read

b)

B. Avoid retyping the same lines of code

c)

C. Both A and B are correct

d)

D. Neither A nor B are correct

8.

In this code, how many times is the "dance" function called and how many times is it defined?

a)

called 1 time, defined 1 time

b)

called 1 time, defined 3 times

c)

called 3 times, defined 1 time

d)

called 3 times, defined 3 times

9.
How do you call a function in JavaScript?
(assume the function name is doStuff)
a)
function doStuff()
b)
doStuff()
c)
doStuff();
d)
function do Stuff(){
//list of steps to execute
}
10.
Which of the following is an example of abstraction?
a)
Writing a function for code you repeat often
b)
Using logic symbols like < and >
c)
Numbers are converted from one base to another
d)
There is an error in the code