Python Code Output Quiz

Python Code Output Quiz

University

20 Qs

quiz-placeholder

Similar activities

Season 4 #Spaic Python Weekly Quiz

Season 4 #Spaic Python Weekly Quiz

KG - Professional Development

20 Qs

Mod 1: Returning to Learning (EQ @ Home)

Mod 1: Returning to Learning (EQ @ Home)

KG - Professional Development

21 Qs

First Gath PSDM

First Gath PSDM

University

20 Qs

Digital Learning 2-Test (study guide)

Digital Learning 2-Test (study guide)

KG - Professional Development

23 Qs

Основы Python

Основы Python

University

19 Qs

Python workshop day2

Python workshop day2

University

20 Qs

Basic Dental Knowledge

Basic Dental Knowledge

University

15 Qs

Day-1 Pre Assessment(Essentials of Data Analytics Using R)

Day-1 Pre Assessment(Essentials of Data Analytics Using R)

University

15 Qs

Python Code Output Quiz

Python Code Output Quiz

Assessment

Quiz

Other

University

Hard

Created by

Logic While

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x = 10 y = 4 result = x ** y // y + y - x % y print(result)

2504

2502

2494

2498

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code produce? x = 4 y = x | (x >> 1) z = y ^ x print(z)

5

2

1

6

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x, y = 10, 20 if x > y: result = x - y elif x < y: result = y - x else: result = x + y print(result)

0

10

20

30

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? x, y = 15, 25 if x > 10 and y < 30: if x + y > 40: print("Sum exceeds 40") else: print("Sum within range") else: print("Condition not met")

Sum exceeds 40

Sum within range

Condition not met

SyntaxError

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x = 0 while x < 5: x += 1 if x == 3: continue print(x, end=" ")

1 2 3 4 5

1 2 4 5

1 2 4

Infinite loop

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? for i in range(3): for j in range(i, 3): print(i + j, end=" ")

0 1 2 1 2 3

0 1 2 2 3 4

1 2 3 1 3 4

0 1 2 3 4 5

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? lst = [1, 2, 3, 4] for i in range(len(lst)): lst[i] += lst[-i - 1] print(lst)

[5, 5, 5, 5]

[5, 5, 7, 7]

[8, 6, 6, 8]

[5, 5, 8, 9]

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?