Python Quiz: Decision Statements & Loops

Python Quiz: Decision Statements & Loops

University

30 Qs

quiz-placeholder

Similar activities

CIPHER QUEST ROUND 1 SET 2

CIPHER QUEST ROUND 1 SET 2

University

25 Qs

Pointers from data structures and algorithms

Pointers from data structures and algorithms

University

25 Qs

PYTHON PROGRAMMING

PYTHON PROGRAMMING

University

30 Qs

Examen 02 Python

Examen 02 Python

3rd Grade - University

31 Qs

Round1

Round1

University

25 Qs

Python Phase 1

Python Phase 1

University

30 Qs

W1 Quiz Basic Concept of Electrical Machine

W1 Quiz Basic Concept of Electrical Machine

University

25 Qs

Diagnostik Lanjut 2

Diagnostik Lanjut 2

University

25 Qs

Python Quiz: Decision Statements & Loops

Python Quiz: Decision Statements & Loops

Assessment

Quiz

Engineering

University

Medium

Created by

Renu Popli

Used 7+ times

FREE Resource

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

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?