Python test 3

Python test 3

8th Grade

20 Qs

quiz-placeholder

Similar activities

Season 4 #Spaic Python Weekly Quiz

Season 4 #Spaic Python Weekly Quiz

KG - Professional Development

20 Qs

Python-ICT

Python-ICT

8th Grade

20 Qs

Python Quiz 1

Python Quiz 1

1st - 12th Grade

18 Qs

Year 8 Computing Revision Quiz

Year 8 Computing Revision Quiz

8th Grade

20 Qs

Python Revision

Python Revision

8th Grade

15 Qs

Review Komputer Mid SMP (1)

Review Komputer Mid SMP (1)

8th Grade

15 Qs

Python Basics

Python Basics

8th - 12th Grade

23 Qs

Python test 3

Python test 3

Assessment

Quiz

Computers

8th Grade

Easy

Created by

Quốc Thư

Used 2+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

x = 10

if x > 5:

........x = x + 1

elif x == 10:

........x = x + 2

else:

........x = x + 3

print(x)

11

12

13

10

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the code below?

def calculate(a, b):

........if a > b:

................return a - b

........else:

................return b - a

x = calculate(5, 10)

print(x)

5

-5

0

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output?

lst = [2, 3, 4]

for i in range(len(lst)):

........lst[i] += 1

print(lst)

[2, 3, 4]

[3, 4, 5]

[2, 4, 6]

Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?

n = 5

fact = 1

while n > 0:

.........fact *= n

.........n -= 1

print(fact)

120

24

60

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following function return? def mystery(x):

.........return x * x - 2 * x + 1

print(mystery(4))

9

4

1

16

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the result?

inner outer

outer inner

inner inner

outer outer

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which output is correct?

numbers = [1, 2, 3, 4, 5]

result = list(map(lambda x: x * x, numbers))

print(result)

[2, 4, 6, 8, 10]

[1, 4, 9, 16, 25]

[1, 2, 3, 4, 5]

Error

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?