Search Header Logo

PCEP Section 2a: Make decisions with if instruction

Authored by Misti McDaniel

Computers

12th Grade

Used 2+ times

PCEP Section 2a: Make decisions  with if instruction
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax for a simple `if` statement in Python?

if x > 10 then print("x is greater than 10")

if x > 10: print("x is greater than 10")

if (x > 10) { print("x is greater than 10") }

if x > 10 print("x is greater than 10")

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Small

Large

Error

5

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to check multiple conditions in sequence after an initial `if` statement in Python?

elseif

elif

else if

when

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Positive

Negative

Zero

Nothing

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to nest an `if` statement inside another `if` statement in Python?

if x > 0: if y > 0: print("Both positive")

if x > 0 then if y > 0 then print("Both positive")

if x > 0: { if y > 0: print("Both positive") }

if x > 0: if y > 0 print("Both positive")

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You want to print "Teenager" if the variable `age` is between 13 and 19 (inclusive). Which of the following code snippets will achieve this?

if age >= 13 and age <= 19: print("Teenager")

if age > 13 and age < 19: print("Teenager")

if 13 < age < 19: print("Teenager")

if age == 13 or age == 19: print("Teenager")

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A

B

C

F

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?