Python If-Else Statements Quiz

Python If-Else Statements Quiz

Assessment

Interactive Video

Computers

9th - 10th Grade

Hard

Created by

Nancy Jackson

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of if-else statements in Python?

To perform arithmetic operations

To create loops

To navigate decision-making paths in code

To store data in variables

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Python, how do you define a block of code that should be executed if a condition is true?

Using square brackets []

Using indentation

Using parentheses ()

Using braces {}

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What function is used to get user input in Python?

read()

raw_input()

get()

input()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if you try to convert a non-integer string to an integer in Python?

The program will convert it to zero

The program will raise a ValueError

The program will print 'NaN'

The program will continue without error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to determine if a number is even or odd?

Modulus operator (%)

Addition operator (+)

Division operator (/)

Multiplication operator (*)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'elif' keyword in Python?

To end a loop

To handle multiple conditions

To define a function

To import a module

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you classify a triangle with all sides of different lengths?

Scalene

Equilateral

Right-angled

Isosceles

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?