Font size
WorksheetsIf-Statements
Total questions: 10
Worksheet time: 10mins
Aria, Ava, and Mia are developing a weather app. In their weather app, what would be the purpose of using an if statement?
To decide whether to display 'Sunny', 'Rainy', or 'Cloudy' based on the weather data
To display the highest temperature of the day
To count the number of times the app has been opened
To change the background color of the app
What does the if statement in the code do when the count reaches 20?
Display a message
Reset the count to 0
Set the screen to "gameOverScreen"
Set the screen to "gamePlayScreen"
What should be added to the down arrow event handler to set the screen to game over when it reaches -5?
If count is equal to -5, then set the screen to "gameOverScreen"
If count is equal to 20, then set the screen to "gamePlayScreen"
If count is equal to -5, then set the screen to "gamePlayScreen"
If count is equal to 10, then set the screen to "gameOverScreen"
What happens when the if statement is triggered by clicking the up arrow 20 times?
The screen changes to "gamePlayScreen"
The final score is displayed
The count is reset to 0
The screen changes to "gameOverScreen"
What is the value of count when the if statement for the up arrow button is triggered?
15
10
20
25
What is the value of count when the if statement for the down arrow button is triggered?
-15
-10
-5
0
What is the event handler for the up arrow button?
onEvent("leftButton", "click", function() {
onEvent("rightButton", "click", function() {
onEvent("downButton", "click", function() {
onEvent("upButton", "click", function() {
What is the event handler for the down arrow button?
onEvent("downButton", "click", function() {
onEvent("rightButton", "click", function() {
onEvent("upButton", "click", function() {
onEvent("leftButton", "click", function() {
is the name of the ID that an action must be taken on for the count to reach 20
(a)
What is the error inside of this if statement?
it should read
if count = -5
it should read
if count == -5
it should read
if count = - 1
it should read
if count == -1
