wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CSP - Unit 4 Code.org Review

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

\n means to add something to a new line in your program

a)

True

b)

False

2.

What is an expression?

a)

numbers, strings, or booleans

b)

combination of operators and values that evaluate to a single value

c)

named group of programming instructions, also called a procedure

d)

affects how the program runs depending on different statements that are based on Boolean values

3.

What will be displayed after this code is run?

a)

You Lose!

b)

Perfect Game!

c)

You Win!

4.

Thinking about truth tables, what does this set of logical operators evaluate to?

! TRUE

a)

True

b)

False

5.
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
6.

A student is writing a program to model different real-world events using simulations.

Which of the following will generate a result that would best be stored using a Boolean variable?


a)

A simulation of flipping a coin

b)

A simulation of rolling a fair die (with sides numbered 1 through 6)

c)

A simulation of the temperature in a location over time

d)

A simulation of traffic patterns on a road

7.

What number will be output by the console.log command on line 7?

a)

10

b)

20

c)

100

d)

200

8.

What is happening in this code?

a)

the variables are being created

b)

the function updateScreen is being declared

c)

the function updateScreen is being called

d)

the function updateScreen is being updated

9.

What is happening in this code?

a)

the variables are being created

b)

the function singChorus is being declared

c)

the function singChorus is being called

d)

the function singChorus is being updated

10.

What are values?

a)

numbers, strings, or booleans

b)

fancy name for add, subtract, divide, multiple

c)

named group of programming instructions, also called a procedure

d)

refers to the remainder

11.

Thinking about truth tables, what does this set of logical operators evaluate to?

TRUE && FALSE

a)

True

b)

False

12.

You should create functions at the top of your program and variables at the bottom of your program.

a)

True

b)

False

13.

In the program, the initial value of the x is 5 and the
initial value of y is 10.

What is displayed after the program is run?

a)

Foxtrot

b)

Hotel

c)

November

d)

Yankee

14.

Once this code is run, what is the value of tickets?

a)

68

b)

103

c)

35

d)

33

15.

a value passed to a function

a)

parameter

b)

argument

16.

What type of variable is this?

a)

Not a variable

b)

variable with concatenation

c)

variable with counter pattern

d)

variable string

17.

What is a variable?

a)

numbers, strings, or booleans

b)

combination of operators and values that evaluate to a single value

c)

fancy name for addition, subtraction, multiplication, and division

d)

portion of the code and program that can hold a value

18.

To attend a particular camp, a student must be either at least 13 years old or in grade 9 or higher,

but must not yet be 18 years old.

Let age represent a student’s age and let grade represent the student’s grade level.

Which of the following expressions evaluates to true if the student is eligible to attend the camp and evaluates to false otherwise?

a)

((age ≥ 13) OR (grade ≥ 9)) AND (age ≤ 18)

b)

((age ≥ 13) OR (grade ≥ 9)) AND (age < 18)

c)

((age ≥ 13) OR (grade ≥ 9)) OR (age ≤ 18)

d)

((age ≥ 13) OR (grade ≥ 9)) OR (age < 18)

19.

"You win!" never displays. What change would fix this issue?

a)

Line 1 - change the variable name to totalScore.

b)

Line 3 - remove var.

c)

Line 4 - change the conditional to >= 5.

d)

Line 5 - change to a getText command.

20.

<-- is written as = in Javascript.

a)

True

b)

False