wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Nested Ifs Part 2

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which of these function categories allow you to evaluate conditions and usually return a value of either TRUE or FALSE?

a)

Date & Time Functions

b)

Lookup & Reference Functions

c)

Math & Trig Functions

d)

Logical Functions

2.

Which of these functions will you use if you wish to evaluate more than one condition?

a)

IF()

b)

IFS()

c)

IFELSE()

d)

IFELSES()

3.

In the function =IF(SUM(B3:B6)>10, "Yes", "No"), which of the two functions will be evaluated first?

a)

IF()

b)

SUM()

4.

What is the result?

number_of_coins = 10

if number_of_coins == 6:

print("You can buy some gum")

else:

if number_of_coins == 10:

print("You are rich")

else:

print("Get a job!")

a)

You can buy some gum

b)

You are rich

c)

Get a job!

d)

You are rich

Get a job!

5.
What is the result?
number_of_coins = 6                           . 
if number_of_coins == 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins == 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
6.
What is the result?
number_of_coins = 1                           . 
if number_of_coins == 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins == 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
7.
What is the result?
number_of_coins = 1                           . 
if number_of_coins < 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins == 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
8.
What is the result?
number_of_coins = 7                           . 
if number_of_coins > 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins < 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
9.
What is the result?
number_of_coins = 6                           . 
if number_of_coins > 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins < 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
10.
What is the result?
number_of_coins = 3                           . 
if number_of_coins > 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins < 10:
.      print("You are rich")
else:                                               .
.  print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
You are rich
Get a job!
11.
What is the result?
number_of_coins = 2                           . 
if number_of_coins > 6:                       .
.          print("You can buy some gum")
else:                                                                      .
if number_of_coins < 10:
.      print("You are rich")
. print("Get a job!")
a)
You can buy some gum
b)
You are rich
c)
Get a job!
d)
Nothing prints
12.

‘If’ is a decision making statement

a)

TRUE

b)

FALSE

13.

There can be an else statement without an if statement

a)

FALSE

b)

TRUE

14.

What is it called when we put an if statement inside of another if statement's body?

a)

grouping

b)

looping

c)

nesting

d)

iterating

15.

What will this code snippet print if the value of num is 12?

a)

A

b)

B

c)

C

d)

D

16.

If age has the value 32, what will be printed?

a)

GROUP 1

b)

GROUP 2

c)

GROUP 3

d)

GROUP 4

17.

If age has the value 14, what will be printed?

a)

GROUP 1

b)

GROUP 2

c)

GROUP 3

d)

GROUP 4

18.

If age has the value 18, what will be printed?

a)

GROUP 1

b)

GROUP 2

c)

GROUP 3

d)

GROUP 4

19.

What will this code snippet print if the value of num is 5?

a)

A

b)

B

c)

C

d)

D

20.

What will be displayed with this code?

a)

Ben is smart

b)

Adam is smart

c)

Nothing

21.

What will be displayed with this code?

a)

Grant is amazing

b)

Noah is amazing

c)

Zach is amazing

d)

Nothing

22.

What will be displayed with this code (pay attention to the variables)?

a)

Belle is wonderful

b)

Krista is wonderful

c)

Allison is wonderful

d)

Nothing

23.

What will be displayed with this code (pay attention to the variables)?

a)

The Best

b)

Average

c)

Nothing

24.

What will be displayed with this code (pay attention to the variables)?

a)

Purdue

b)

IU

c)

Butler

d)

Nothing

25.

What will be displayed with this code (pay attention to the variables)?

a)

Taylor is going to North Carolina

b)

Taylor is going to IU

c)

Nothing

26.

What will be displayed with this code (pay attention to the variables)? The percentage sign here means that the reminder obtained by 5 / 3. So t reads, that "t" is assigned the result of the remainder of 5 divided by 3 multiple by 9

a)

Jacob is a better Nascar fan

b)

Tarun is a better Nascar fan

c)

Nothing

27.
What is my result?
mickey = mouse                                   .
if mickey == mouse:                           .
.            print("Mickey is a mouse")
.else:                                                             .
.         print("Minnie rules")        .
a)
"Mickey is a mouse"
b)
"Minnie rules"
c)
Nothing prints.
d)
"Mickey is a mouse" & "Minnie rules"
28.
What is my result?
john = 5                                                                        .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
print("John is getting grapes")                    .
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
29.
What is my result?
john = 10                                                                     .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
print("John is getting grapes")                    .
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
30.
What is my result?
john = 8                                                                        .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
.      print("John is getting grapes")
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
31.
What is my result?
john = 8                                                                        .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
.      print("John is getting grapes")
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
32.
What is my result?
john = 6                                                                        .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
.      print("John is getting grapes")
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
33.
What is my result?
john = 6                                                                        .
if john != 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
.      print("John is getting grapes")
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
34.

What is my result?

john = 3 .

if john < 6: .

. print("John is getting ice cream")

else: .

. print("John is getting apple juice")

print("John is getting grapes") .

a)

John is getting ice cream

John is getting grapes

b)

John is getting apple juice

John is getting grapes

c)

John is getting apple juice

d)

John is getting ice cream

35.

The "If" Statement is an example of a _________________

a)

Correctional Statement

b)

Competitive Statement

c)

Conditional Statement

d)

Inquisitive Statement

36.

True/False: The body of an "if" statement will only be executed if the condition is true.

a)

True

b)

False

37.

Which of these is used to add a third, fourth, etc outcome to a scenario?

a)

otherwise

b)

else if

c)

iff

d)

elsa

38.

What will be the output of the code?

a)

Even

b)

EvenDivisible by 3

c)

Even

Divisible by 3

d)

Not Divisible by 6

39.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

40.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2