Search Header Logo

Python Code Output Quiz

Authored by Yasmeen Kanwal

Computers

5th Grade

Used 4+ times

Python Code Output Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? def calculate (num1, num2=4): res = num1 * num2 print(res) calculate(5, 6) Hint: functions in Python

20

The program executed with errors

30

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can we use the “else” block for for loop? for example: for i in range(1, 5): print(i) else: print("this is else block statement" )

No

Yes

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following x = 36 / 4 * (3 + 2) * 4 + 2 print(x) Hint: Python Operators Precedence

182.0

37

117

The Program executed with errors

4.

OPEN ENDED QUESTION

3 mins • 1 pt

Which operator has higher precedence in the following list % (Modulus) & (BitWise AND) ** (Exponent) > (Comparison)

Evaluate responses using AI:

OFF

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The in operator is used to check if a value exists within an iterable object container such as a list. Evaluate to True if it finds a variable in the specified sequence and False otherwise.

True

False

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? var = "James" * 2 * 3 print(var)

JamesJamesJamesJamesJamesJames

JamesJamesJamesJamesJames

Error: invalid syntax

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? str = "pynative" print (str[1:3])

py

yn

pyn

yna

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?