NEW
Font size
WorksheetsIf/Else Introduction (Logic)
Total questions: 14
Worksheet time: 7mins
The "If" Statement is an example of a _________________
Correctional Statement
Competitive Statement
Conditional Statement
Inquisitive Statement
True/False: The body of an "if" statement will only be executed if the condition is true.
True
False
How many "if" statements can a single program have?
<10
<20
<30
As many as is needed
What happens to the code in the body of an "if" statement if the condition is false?
The computer determines if it is essential to the program and if it is, then the code is executed anyway.
The code moves to a coastal city, attempting to find love and start a family. However, low waged and crushing mortgage rates lead to it moving back home where it sits, hoping that one day it will be executed.
The code is skipped.
The code stages a revolution and attempts to take over the program, ultimately unsuccessfully, which leads to it not being executed.
Which of these can be paired with an "if" statement to represent other outcomes of a scenario?
or
else
but
sheboygan
How many "else" statements can you pair with a single "if" statement
1
<10
<20
As many as is needed.
How many "else if" links can you have in an "if/else" chain?
<10
<20
<30
As many as is needed to represent the situation
2 + 2 == 4
What would happen if Elsa built a snowman?
If Elsa built a snowman
Anna would go and play
Else if Elsa built a castle
Anna would try to stay in the castle
Else
Anna and Elsa starts to sing!
Anna would go play
Anna would try to stay in the castle
Anna and Elsa starts to sing!
Nothing would happen
What would happen if Elsa did not build a snowman or a castle?
If Elsa built a snowman
Anna would go and play
Else if Elsa built a castle
Anna would try to stay in the castle
Else
Anna and Elsa starts to sing!
Anna would go and play
Anna would try to stay in the castle
Anna and Elsa starts to sing!
Nothing would happen
If it is sunny and windy
It is a good day to go on a picnic!
Else if it is rainy and cold
It is a good day to stay inside!
Else
It is a good day to drink hot chocolate!
If I wanted to stay inside, what needs to happen?
Sunny and Windy
Rainy and Cold
Neither Sunny, windy, rainy or cold
Sunny and Rainy
If it is sunny and windy
It is a good day to go on a picnic!
Else if it is rainy and cold
It is a good day to stay inside!
Else
It is a good day to drink hot chocolate!
If I drank hot chocolate, then what happened?
It was sunny and windy
It was rainy and cold
Neither sunny, windy, rainy, or cold
It was sunny and cold
What is my result?
John is 5
if John > 6:
John is getting ice cream
else:
John is getting apple juice
John is getting grapes
John is getting ice cream
John is getting grapes
John is getting apple juice
John is getting grapes
John is getting apple juice
John is getting ice cream
