Python If-Else Quiz

Python If-Else Quiz

5th Grade

10 Qs

quiz-placeholder

Similar activities

Python If ... Else

Python If ... Else

Python Conditionals Practice

Python Conditionals Practice

Python if else

Python if else

Python If Else Statements

Python If Else Statements

Python 2 Conditionals Quiz

Python 2 Conditionals Quiz

Python if/else

Python if/else

Python If-Else Quiz

Python If-Else Quiz

Assessment

Quiz

Computers

5th Grade

Practice Problem

Medium

Created by

Seba Robert

Used 39+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for an if-else statement in Python?

if condition:

code to be executed if the condition is true

else:

code to be executed if the condition is false

if condition:

code to be executed if the condition is true

else if condition:

code to be executed if the condition is false

if condition:

code to be executed if the condition is true

code to be executed if the condition is false

if condition:

code to be executed if the condition is true elif condition:

code to be executed if the condition is false

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many conditions can be checked in a single if-else statement?

4

3

2

1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the else statement in an if-else statement?

To provide an alternative set of instructions when the condition in the if statement is false.

To skip the if statement and move to the next statement.

To execute the same set of instructions as the if statement.

To terminate the execution of the program.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to check for equality in an if-else statement?

<>

!=

==

===

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if the condition in an if statement is False?

The code block inside the if statement will be executed twice.

The code block inside the if statement will still be executed.

The code block inside the if statement will throw an error.

The code block inside the if statement will be skipped.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? x = 5 if x > 10: print('Greater than 10') else: print('Less than or equal to 10')

Greater than 10

Equal to 10

Greater than or equal to 10

Less than or equal to 10

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? x = 10 if x == 10: print('Equal to 10') else: print('Not equal to 10')

Equal to 10

Greater than 10

Not equal to 10

Equal to 5

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers