wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Code.org 8th Grade Part 2 (Conditionals and the Draw Loop)

Total questions: 53

Worksheet time: 43mins

Name
Class
Date
1.

the if(keyDown(up)) returns

a)

a boolean value of true if the user presses the down key

b)

a boolean value of false if the user presses the down key

c)

A boolean value of true if the user presses the up key

d)

A boolean value of false if the user presses the up key

2.

In the draw loop, if you call the text function before the drawSprites and/or background function, what happens?

a)

You won't be able to see your text because the sprites and background will be drawn on top of the text.

b)

You will be able to see your text because Game Lab knows you want to see the text.

c)

You won't be able to see your sprites or background because order doesn't matter.

d)

You will be able to see your text because the sprites and the background will be drawn after the text.

3.

Predict what will show up on console.log

a)

true true true

b)

true false false

c)

false false false

d)

true false true

4.

What happens in this code?

a)

nothing is shown, there are no sprites

b)

the background is white and we can't see anything because the textsize is 0;

c)

the background is white, the counter increases in size as the counter increase.

d)

the background is white, and we see a number that goes up but the textsize stays the same.

5.

What happens if you don't call background in your draw loop and your sprite has movement?

a)

nothing, animation is fine.

b)

the sprites are drawn on top of each other to simulate movement, the older drawings don't get erased.

c)

you don't need to call background because you don't have one.

d)

you can just use sprite.move( ) so there's no need for the function background( )

6.

What happens if you don't call background in your draw loop and your sprite has movement?

a)

nothing, animation is fine.

b)

the sprites are drawn on top of each other to simulate movement, the older drawings don't get erased.

c)

you don't need to call background because you don't have one.

d)

you can just use sprite.move( ) so there's no need for the function background( )

7.
Boolean Expression
a)
a single image within an animation
b)
A single value of either TRUE or FALSE
c)
A piece of code that you can easily call over and over again.
d)
Finding and fixing problems in your algorithm or program.
8.

In this scenario it is raining. Is the conditional true or false and what will we do in this scenario.

a)

true, we will stay indoors

b)

true, we will go outside

c)

false, we will stay indoors

d)

false, we will go outside

9.

Which key makes the player move to the right?

a)

The left arrow key

b)

The right arrow key

c)

Neither

10.

Which values stored in lives would cause the gameOver sprite to become visible?

a)

1

b)

2

c)

3

d)

-2

e)

0

11.

Is the boolean expression on line 14 currently true or false?

a)

True

b)

False

12.

Is the boolean expression on line 14 currently true or false?

a)

True

b)

False

13.

Is the boolean expression on line 14 currently true or false?

a)

True

b)

False

14.

Oh no! This code is all messed up! Read the code carefully. Which direction will the sprite go if the up arrow is pressed?

a)

Up

b)

Down

c)

Left

d)

Right

15.

Oh no! This code is all messed up! Read the code carefully. Which direction will the sprite go if the down arrow is pressed?

a)

Up

b)

Down

c)

Left

d)

Right

16.

Which of these increases the values of clicks when the space key has been released?

a)
b)
c)
d)
17.

Which of these places an incorrect block into the condition for the if statement?

a)
b)
c)
d)
18.

What would be the best natural (normal) english way to say the code shown?

a)

bird3.scale is assigned the value of 0.25

b)

change bird3.scale is changed by 0.25

c)

decrease bird3.scale by 0.25

d)

none of these

19.

Which of these is the best match for this statement: "bird2.y is assigned 300"

a)

b)

c)

d)

20.

Which of these is the best match for line two?

a)

greenFish.x is counted down by 1

b)

greenFish.x is counted down by 2

c)

greenFish.x is counted down by 3

d)

greenFish.x is counted up by 1

e)

greenFish.x is counted up by 2

21.

Is the coke sprite's rotation less than the pepsi sprite's rotation?

a)

coke.rotation > pepsi.rotation

b)

coke.rotation >= pepsi.rotation

c)

coke.rotation < pepsi.rotation

d)

coke.rotation == pepsi.rotation

e)

coke.rotation != pepsi.rotation

22.

Is the coke sprite's rotation greater than the pepsi sprite's rotation?

a)

coke.rotation > pepsi.rotation

b)

coke.rotation >= pepsi.rotation

c)

coke.rotation < pepsi.rotation

d)

coke.rotation == pepsi.rotation

e)

coke.rotation != pepsi.rotation

23.

Is the coke sprite's rotation greater than or the same as the pepsi sprite's rotation?

a)

coke.rotation > pepsi.rotation

b)

coke.rotation >= pepsi.rotation

c)

coke.rotation < pepsi.rotation

d)

coke.rotation == pepsi.rotation

e)

coke.rotation != pepsi.rotation

24.

Is the coke sprite's rotation the same as the pepsi sprite's rotation?

a)

coke.rotation > pepsi.rotation

b)

coke.rotation >= pepsi.rotation

c)

coke.rotation < pepsi.rotation

d)

coke.rotation == pepsi.rotation

e)

coke.rotation != pepsi.rotation

25.

Is the coke sprite's rotation not the same as the pepsi sprite's rotation?

a)

coke.rotation > pepsi.rotation

b)

coke.rotation >= pepsi.rotation

c)

coke.rotation < pepsi.rotation

d)

coke.rotation == pepsi.rotation

e)

coke.rotation != pepsi.rotation

26.

If the dinosaur's y position is greater than 200, then the dinosaur should change the costume to a pterodactyl.

a)

b)

c)

d)

e)

None of these

27.

If the dinosaur's y position is less than 200, then the dinosaur should change the costume to a pterodactyl.

a)
b)
c)
d)
e)

None of these

28.

If the dinosaur's y position is the same as 200, then the dinosaur should change the costume to a pterodactyl.

a)
b)
c)
d)
e)

None of these

29.

If the dinosaur's y position is not the same as 200, then the dinosaur should change the costume to a pterodactyl.

a)
b)
c)
d)
e)

None of these

30.

If the dinosaur's y position is greater than or the same as 200, then the dinosaur should change the costume to a pterodactyl.

a)
b)
c)
d)
e)

None of these

31.

Which of these matches the graph shown?

a)

sprite.x < -1

b)

sprite.x <= -1

c)

sprite.x >= -1

d)

sprite.x > -1

32.

Which of these matches the inequality shown?

a)

sprite.scale > 2

b)

sprite.scale < 2

c)

sprite.scale >= 2

d)

sprite.scale <= 2

e)

None of these

33.

What does this code affect?

a)

It affects the sprite's up and down motion

b)

It affects the sprite's right and left motion

c)

It affects the sprite's appearance (on a tilt, upside down, etc.)

d)

It affects the sprite's size

34.

What is true about this code? (pick all that apply)

a)

It is used to put something in the grid

b)

It is for use by the coder

c)

It usually shows the status of a condition

d)

Its results show up in the debug console

35.

What is true about these codes?

a)

They give number values to things

b)

They change the values of counters

c)

They perform math operations

d)

They are used to compare

36.

Which of these is used when you want something to happen when a certain key is pressed, but not held down?

a)

keyDown

b)

keyWentUp

c)

keyWentDown

37.

What does the top code do?

a)

It tracks whether the mouse is moved

b)

It tracks the motion of the mouse right or left

c)

It tracks the motion of the mouse up or down

d)

It tracks whether a button on the mouse is pressed

38.

What is true about this code? (pick all that apply)

a)

It updates two values for a sprite in a draw loop

b)

It is made up of counters

c)

It moves the sprite down and to the right

d)

It moves the sprite up and to the right

39.

What is true about this code? (pick all that apply)

a)

It moves the sprite to the right

b)

It moves the sprite down

c)

It updates a specific sprite value in a draw loop

d)

It's called a counter

40.

What is true about this code? (pick all that apply)

a)

It usually uses the same comparisons from a console log

b)

It can make something happen on the grid if a condition is met

c)

It can make something happen on the grid if a condition is NOT met

d)

It shows "true" or "false" in the debug console

41.

What does this code affect?

a)

It affects the appearance the sprite (on a tilt, upside down, etc.)

b)

It affects the size of the sprite

c)

It affects how far up or down the sprite moves

d)

It affects how far right or left the sprite moves

42.

What does the sprite animation look like?

a)

Move your sprite up

b)

Rotate your sprite clock wise

c)

Make your sprite grow

d)

Move your sprite down

43.

What does the sprite animation look like?

a)

Move your sprite up

b)

Rotate your sprite clock wise

c)

Move your sprite to the right

d)

Move your sprite down

44.

What does the sprite animation look like?

a)

Move your sprite to the left

b)

Rotate your sprite clock wise

c)

Move your sprite to the right

d)

Make your sprite grow

45.

(5 == 3)

a)

True

b)

False

46.

(5 < = 5)

a)

True

b)

False

47.

(5 > 3)

a)

True

b)

False

48.

Which of the following is an example of a boolean value?

a)

true

b)

2

c)

"hello"

d)

"red"

49.

Which of the following is an example of a sprite's rotation property?

a)

sprite.x

b)

sprite.rotation

c)

rotateSprite()

d)

sprite.around

50.

Which of the following values can be returned by the code: randomNumber (0, 10)?

a)

-1

b)

3

c)

11

d)

10.5

51.

Which of the following Random Number functions would return a value between 1 and 10?

a)

randomNumber(10);

b)

randomNumber(1, 10);

c)

randomNumber(1-10);

d)

random(10);

52.

Which of the following ellipses has a width of 250 and height 100?

a)

ellipse(100, 100, 250, 100);

b)

circle(250, 50);

c)

rect(100, 100, 250, 100);

d)

ellipse(50, 100);

53.

What would the counter pattern for losing a life in a game look like?

a)

lives = -1;

b)

lives = lives;

c)

lives = lives -1;

d)

lives = 1;