Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Code.org APCSP Unit 6 Review

Total questions: 29

Worksheet time: 17mins

Name
Class
Date
1.

Which of the following images is the most likely outcome of the drawing?

a)
b)
c)
d)
2.

What is a possible output when the following code segment executes? The ending position of the turtle is shown in each diagram. The starting position is shown as a white triangle in cases where the turtle starts and ends in different locations.

a)
b)
c)
d)
e)
3.
a)
b)
c)
d)
e)
4.

Which of the following is true about while loops ?

a)

While loops terminate after a fixed number of loops that is pre-determined

b)

While loops terminate after a fixed number of loops that is determined after the loop executes once.

c)

While loops run as long as a given boolean condition is true.

d)

While loops run as long as a given boolean condition is false.

e)

While loops are known as "forever loops" and never stop until the program is halted by the user.

Answer

5.
a)

4

b)

7

c)

9

d)

10

e)

ab

6.
a)

2

b)

3

c)

4

d)

5

e)

6

7.
a)

0

b)

1

c)

2

d)

8

e)

Error. Index 3 does not exist.

8.
a)
b)
c)
d)
e)
9.

What will happen when this code runs?

a)

it will print each fruit and the price on a new line

b)

It will print all the fruits and prices at once

c)

It will print "fruit cost price"

d)

It will change the fruit list to be the price list

10.

What goes in the part that's blacked out

a)

i < foot.length

b)

i < fruit

c)

i < fruits

d)

i < fruits.length

11.

What goes in the part that's blacked out

a)

var i = 0

b)

i = fruit

c)

i < fruits.length

d)

i = 0

12.

What does this code do?

a)

prints the index + 1 number and the name of the pet for each pet in the favoritePets list

b)

prints each pet

c)

prints the number of the pet

d)

prints the index number and the name of the pet

13.

What is created at the end of this loop?

a)

Nothing happens

b)

All the animals are printed out

c)

Each animal is printed out in the filtered animals list

d)

Animal words that are greater than 5 letters are put into a filtered list

14.

If the animal whose length of their name is greater than 5 are put into a list, what should that list look like at the beginning of the code?

a)

var animalsFiltered = ['dog', 'cat', 'pig]

b)

var animalsFiltered = []

c)

animalsFiltered = ['dog', 'cat', 'pig]

d)

animalsFiltered = []

15.

What does this code do?

a)

Finds the maximum price

b)

Prints each price

c)

Does nothing

d)

Finds the minimum price

16.

What would you change to find the max price?

a)

if price > maxPrice

b)

if price<maxPrice

c)

if price == 0

d)

if maxPrice = minPrice

17.

What does this do?

a)

Goes through a state list and checks the year of the state.

b)

Goes through a state list and checks the name of the state

c)

Adds the name of the state to a new list

d)

Adds the year of the state to the new list

18.

What should you do here?

a)

state = statesList[i]

b)

year= yearList[i]

c)

state = state[i]

d)

year= year[i]

19.

What does this do?

a)

It filters through the student GradeList

b)

it looks for student grades that are 11

c)

it appends the student name, grade, and age to an empty list

d)

it looks for the youngest student

20.

What should go in the blacked out part?

(a)  

21.

Why is this block of code there?

a)

creates the filtered lists

b)

sets the variables to 0

c)

makes the lists empty when you first run the function

d)

makes the lists show on the screen

22.

What should be in this part?​​

a)

appendItem(filteredStudentNameList, studentNameList[i])

b)

appendItem(filteredStudentAgeList, studentAgeList[i])

c)

appendItem(filteredList[i])

d)

studentGradeList[i] = 0

23.

You want the index to be a random number in the list. What should go in the blacked out part?

a)

fruitList.length - 1

b)

fruitList.length

c)

index.length - 1

d)

index.length

24.

What code is blacked out?

a)

setText("fruitLabel", "text", myList[index]);

b)

appendItem(myList, "peach");

c)

updateScreen();

d)

index = 0;

25.

What should go in the part that is blacked out?

a)

"banana"

b)

fruitList

c)

"fruitList"[index+1]

d)

fruitList[index]

26.

When you click the left button to go down 1 on the index, what do you want to check on first? (2 answers)

a)

if you are at the beginning of the list

b)

if the index is greater than 0

c)

if the index is at the end of the list

d)

if the index is less than the length - 1

27.

When you click the right button to go up 1 on the index, what do you want to check on first? (2 answers)

a)

if you are at the beginning of the list

b)

if the index is greater than 0

c)

if the index is at the end of the list

d)

if the index is less than the length - 1

28.

What is the missing code?

(a)  

29.

What code is missing?

a)

myList[index]

b)

index

c)

"pear"

d)

myList[0]