wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

If-Statements

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

Aria, Ava, and Mia are developing a weather app. In their weather app, what would be the purpose of using an if statement?

a)

To decide whether to display 'Sunny', 'Rainy', or 'Cloudy' based on the weather data

b)

To display the highest temperature of the day

c)

To count the number of times the app has been opened

d)

To change the background color of the app

2.

What does the if statement in the code do when the count reaches 20?

a)

Display a message

b)

Reset the count to 0

c)

Set the screen to "gameOverScreen"

d)

Set the screen to "gamePlayScreen"

3.

What should be added to the down arrow event handler to set the screen to game over when it reaches -5?

a)

If count is equal to -5, then set the screen to "gameOverScreen"

b)

If count is equal to 20, then set the screen to "gamePlayScreen"

c)

If count is equal to -5, then set the screen to "gamePlayScreen"

d)

If count is equal to 10, then set the screen to "gameOverScreen"

4.

What happens when the if statement is triggered by clicking the up arrow 20 times?

a)

The screen changes to "gamePlayScreen"

b)

The final score is displayed

c)

The count is reset to 0

d)

The screen changes to "gameOverScreen"

5.

What is the value of count when the if statement for the up arrow button is triggered?

a)

15

b)

10

c)

20

d)

25

6.

What is the value of count when the if statement for the down arrow button is triggered?

a)

-15

b)

-10

c)

-5

d)

0

7.

What is the event handler for the up arrow button?

a)

onEvent("leftButton", "click", function() {

b)

onEvent("rightButton", "click", function() {

c)

onEvent("downButton", "click", function() {

d)

onEvent("upButton", "click", function() {

8.

What is the event handler for the down arrow button?

a)

onEvent("downButton", "click", function() {

b)

onEvent("rightButton", "click", function() {

c)

onEvent("upButton", "click", function() {

d)

onEvent("leftButton", "click", function() {

9.

is the name of the ID that an action must be taken on for the count to reach 20

(a)  

10.

What is the error inside of this if statement?

a)

it should read

if count = -5

b)

it should read

if count == -5

c)

it should read

if count = - 1

d)

it should read

if count == -1