Search Header Logo

Understanding Python Selection Basics

Authored by J Blakley

Information Technology (IT)

8th Grade

Used 2+ times

Understanding Python Selection Basics
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code print? ```python temperature = 18 if temperature < 20: print("It's a bit chilly today.") else: print("It's warm today.") ```

It's warm today.

It's a bit chilly today.

18

Nothing will be printed.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a comparison operator in Python?

and

or

==

not

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following expression? ```python 5 > 3 and 2 < 1 ```

True

False

5

2

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement will check if a variable `age` is at least 16?

if age > 16:

if age <= 16:

if age >= 16:

if age == 16:

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code print? ```python colour = "blue" if colour == "red": print("Stop") else: print("Go") ```

Stop

Go

blue

Nothing

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a logical operator in Python?

>

and

=

!=

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? ```python x = 10 if x != 5: print("x is not 5") else: print("x is 5") ```

x is 5

x is not 5

10

Nothing

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?