Python Quiz: Decision Statements & Loops

Python Quiz: Decision Statements & Loops

University

•

30 Qs

quiz-placeholder

Similar activities

Grundlagen E-Technik

Grundlagen E-Technik

University

•

28 Qs

Electron devices

Electron devices

University

•

25 Qs

Kuis SC-5 Gamtek Gasal 2526

Kuis SC-5 Gamtek Gasal 2526

University

•

25 Qs

Introduction to Industrial Engineering 2

Introduction to Industrial Engineering 2

University

•

25 Qs

Ag Mech 2023 National Exam

Ag Mech 2023 National Exam

12th Grade - University

•

25 Qs

2.1 - Sketching

2.1 - Sketching

10th Grade - University

•

25 Qs

network

network

University

•

26 Qs

Tema 5: TORSIÓN

Tema 5: TORSIÓN

University

•

28 Qs

Python Quiz: Decision Statements & Loops

Python Quiz: Decision Statements & Loops

Assessment

Quiz

•

Engineering

•

University

•

Practice Problem

•

Medium

Created by

Renu Popli

Used 7+ times

FREE Resource

AI

Enhance your content in a minute

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

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax of an `if` statement in Python?

if (x > 5)

if x > 5:

if x > 5 { }

if x > 5 then:

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to check multiple conditions in Python?

elseif

elif

else if

ifelse

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? x = 7 if x % 2 == 0: print("Even") else: print("Odd")

Even

Odd

7

Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a valid relational operator in Python?

!=

<>

>=

<

5.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Consider this code: x = 10 if x > 5: print("A") if x > 8: print("B") What will be the output?

A

B

A B

None

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is true about the `else` block in Python?

It must always follow `if`

It must always follow `elif`

It can follow `if` or `elif`

It is optional

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output? a = 3 if a == 3: print("Yes") else: print("No")

Yes

No

3

Error

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?