Python Quiz: Decision Statements & Loops

Python Quiz: Decision Statements & Loops

University

•

30 Qs

quiz-placeholder

Similar activities

D29 QUIZ OF THE DAY

D29 QUIZ OF THE DAY

University

•

25 Qs

Programming Lab Quiz

Programming Lab Quiz

University

•

25 Qs

Tema 2 Interfaces y redes industruales

Tema 2 Interfaces y redes industruales

University

•

25 Qs

Instrumentation - Chap I & II

Instrumentation - Chap I & II

University

•

25 Qs

SOAL SISTEM KELISTRIKAN BODY 1

SOAL SISTEM KELISTRIKAN BODY 1

11th Grade - University

•

25 Qs

21CSS201T_COA

21CSS201T_COA

University

•

25 Qs

ARM Instruction Set Quiz

ARM Instruction Set Quiz

University

•

25 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?