Understanding Python Conditionals

Understanding Python Conditionals

11th Grade

10 Qs

quiz-placeholder

Similar activities

Excel

Excel

10th - 11th Grade

10 Qs

C++ dasar

C++ dasar

10th - 12th Grade

9 Qs

Cambridge Nationals IT Data Types Recap

Cambridge Nationals IT Data Types Recap

11th Grade

11 Qs

PAS GANJIL 2024

PAS GANJIL 2024

11th Grade

10 Qs

J808 LO1 and LO2 planning project keywords / terms

J808 LO1 and LO2 planning project keywords / terms

9th - 11th Grade

15 Qs

Social media influencers

Social media influencers

6th - 12th Grade

10 Qs

Kuis Dadakan ;)

Kuis Dadakan ;)

10th Grade - University

15 Qs

Паскаль. Основные команды

Паскаль. Основные команды

8th - 11th Grade

10 Qs

Understanding Python Conditionals

Understanding Python Conditionals

Assessment

Quiz

Computers

11th Grade

Practice Problem

Medium

Created by

Kavita Bhagat

Used 1+ 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 will be the output of the following code: if x > 10: print('Greater') elif x < 10: print('Lesser') else: print('Equal')?

Greater

Undefined

Lesser

Equal

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a Python program using if-elif-else to check if a number is positive, negative, or zero.

number = int(input('Enter a number: ')) if number < 0: print('Zero') elif number > 0: print('Negative') else: print('Positive')

number = float(input('Enter a number: ')) if number >= 0: print('Zero') else: print('Positive')

number = float(input('Enter a number: ')) if number > 0: print('Positive') elif number < 0: print('Negative') else: print('Zero')

number = input('Enter a number: ') if number == 0: print('Positive') else: print('Negative')

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How does the if statement differ from the if-elif-else statement in Python?

The 'if' statement is used for defining functions.

The 'if' statement checks one condition, while 'if-elif-else' checks multiple conditions in sequence.

The 'if-elif-else' statement is used for loops only.

The 'if' statement can check multiple conditions at once.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed if x = 5 in the following code: if x > 10: print('High') elif x == 5: print('Medium') else: print('Low')?

Very High

Low

High

Medium

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Create a conditional statement that checks if a student has passed based on their marks (pass mark is 40).

if (marks < 40) { return 'Passed'; } else { return 'Failed'; }

if (marks == 40) { return 'Failed'; } else { return 'Passed'; }

if (marks > 40) { return 'Failed'; } else { return 'Passed'; }

if (marks >= 40) { return 'Passed'; } else { return 'Failed'; }

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the use of the else statement in an if-elif-else structure.

The 'else' statement provides a default action when all other conditions fail.

The 'else' statement can only be used with a single if condition.

The 'else' statement is used to replace the if statement entirely.

The 'else' statement is only executed if the first condition is true.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code: if a == b: print('Equal') elif a > b: print('A is greater') else: print('B is greater')?

A is always greater

B is always greater

Equal regardless of values

Depends on the values of a and b

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

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?