Search Header Logo

Mastering Python Control Structures

Authored by Junel Ventura

Information Technology (IT)

University

Used 3+ times

Mastering Python Control Structures
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: if 5 > 3: print('True') else: print('False')?

False

Maybe

Not Sure

True

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

if (condition) do_something

if condition: do_something

if: condition do_something

if condition do_something;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code: x = 10; if x < 5: print('Low'); elif x < 15: print('Medium'); else: print('High')?

High

Low

Very High

Medium

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Python, which operator is used for logical AND in conditions?

not

||

and

&&

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following expression: True and False?

True

False

Neither True nor False

False and True

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: if 10 > 5: print('A'); if 10 < 5: print('B')?

C

A

B

D

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a chained if statement?

if (condition1) { // code } else { // code }

if (condition1) { // code }

if (condition1) { // code } else if (condition2) { // code } else { // code }

if (condition1) { // code } else if (condition2) { // code } else if (condition3) { // code }

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?