Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Test10

Total questions: 30

Worksheet time: 30mins

Name
Class
Date
1.

What is the output of this code?

a)

1

b)

2

c)

None

d)

Error

2.

What is the result of 5 % 2 * 3 // 2?

a)

0

b)

1

c)

2

d)

3

3.

What is the output of the following code?

a)

0

b)

1

c)

None

d)

Error

4.

What will be the result of:

a)

'36'

b)

'336'

c)

'333*2'

d)

'3336'

5.

What will this print?

a)

True

b)

False

c)

"True"

d)

Error

6.

Which values are falsy in Python?

a)

""

b)

[]

c)

None

d)

"False"

7.

How many times will "Hi" be printed?

a)

3

b)

4

c)

Infinite

d)

0

8.

What is the result of this?

a)

1

b)

2

c)

TypeError

d)

None

9.

What will this code do?

a)

Yes

b)

No

c)

Error

d)

Nothing

10.

What is the output?

a)

1 2 3 4

b)

1 3

c)

2 4

d)

1 3 5

11.

What happens here?

a)

5

b)

0

c)

Error

d)

None

12.

What does x = [None] * 3 create?

a)

Empty list

b)

List with 3 Nones

c)

List with 1 None

d)

Syntax error

13.

Which list methods modify the list in place?

a)

append()

b)

sort()

c)

+

d)

insert()

14.

What is the output?

a)

[1] and [1]

b)

[1] and [1, 1]

c)

[1] and []

d)

Error

15.

What will this print?

a)

True

b)

False

c)

0

d)

Error

16.

What is the output?

a)

True

b)

False

c)

Error

d)

None

17.

Which of these are valid slices for s = "abcdef"?

a)

s[::2]

b)

s[-1:2]

c)

s[:100]

d)

s[2:2]

18.

What is the result of:

a)

True

b)

False

c)

None

d)

Error

19.

Which of the following statements are true about functions in Python?

a)

A function must return a value

b)

A function can return nothing

c)

A function must take at least one parameter

d)

A function must use return

20.

What does this print?

a)

[1, 2, 3]

b)

[1, 2]

c)

Error

d)

None

21.

What is the output?

a)

[1, 2]

b)

[1, 2, 3]

c)

Error

d)

None

22.

What is the result of:

a)

True

b)

False

c)

None

d)

Error

23.

Which operator has higher precedence?

a)

and

b)

or

c)

not

d)

==

24.

What does this code print?

a)

[]

b)

[1, 2, 3]

c)

None

d)

Error

25.

What will be the result?

a)

1

b)

2

c)

Error

d)

None

26.

What happens here?

a)

3

b)

-1

c)

Error

d)

1

27.

What does None == False return?

a)

True

b)

False

c)

None

d)

Error

28.

What will be the output?

a)

1

b)

True

c)

False

d)

0

29.

Which of these is not a valid string method?

a)

split()

b)

strip()

c)

pop()

d)

find()

30.

What will this print?

a)

"c"

b)

""

c)

"abc"

d)

Error