wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python L1 Programming Challenge

Total questions: 30

Worksheet time: 22mins

Name
Class
Date
1.

What is the output of this code?

a)

a

b)

dog

c)

o

d)

g

2.

What is the output of this code?

a)

2 3 4 5 6 7

b)

4 6 8

c)

2 4 6 8

d)

3 5 7 9

3.

What is the output of this code?

a)

1 2 3 4 1 2 3 4

b)

0 1 2 3 1 2 3 4

c)

0 1 2 3 4 1 2 3 4 5

d)

1 2 3 4 2 3 4 5

4.

What is the output of this code?

a)

8

b)

Type Error

c)

53

d)

Syntax Error

5.

What is the output of this code?

a)

79

b)

Syntax Error

c)

16

d)

Type Error

6.

What is the output of this code?

a)

A

b)

B

c)

C

d)

D

7.

What is the output of this code?

a)

<class 'int'>

b)

<class 'char'>

c)

<class 'str'>

d)

<class 'float'>

8.

What is the output of this code?

a)

<class 'int'>

b)

<class 'char'>

c)

<class 'str'>

d)

<class 'float'>

9.

What is the output of this code?

a)

3

b)

3.0

c)

9/3

d)

SyntaxError

10.

When will this loop terminate?

a)

When keep_on_going is greater than 999

b)

When keep_on_going is not equal to 999

c)

When keep_on_going is equal to 999

d)

When keep_on_going is less than 999

11.

This python code draws a _____.

a)

Star

b)

Circle

c)

Rectangle

d)

Square

12.

What is the output of this code?

a)

24

b)

38

c)

19

d)

70

13.

What is the output of this code?

a)

2

b)

2.5

c)

3

d)

3.5

14.

What is the output of this code?

a)

Correct! Thanks for playing

b)

Correct!

c)

Thanks for playing

d)

SyntaxError

15.

What is the output of this code?

a)

foo

b)

bar

c)

foobar

d)

Nothing is printed

16.

What is the output of this code?

a)

True

b)

False

c)

True and False

d)

SyntaxError

17.

What is the output of this code?

a)

True

b)

False

c)

x < y or z < y

d)

SyntaxError

18.

What is the output of this code?

a)

Always True

b)

Always False

c)

Sometimes True, Sometimes False

d)

SyntaxError

19.

What is the output of this code?

a)

Always True

b)

Always False

c)

Sometimes True, Sometimes False

d)

SyntaxError

20.

What is the output of this code?

a)

Always True

b)

Always False

c)

Sometimes True, Sometimes False

d)

SyntaxError

21.

What is the output of this code?

a)

Always True

b)

Always False

c)

Sometimes True, Sometimes False

d)

SyntaxError

22.

What is the output of this code?

a)

10 is good

b)

10 is out of bounds!

c)

out of bounds!

d)

NameError: name 'outOfBounds' is not defined

23.

What is the output of this code?ㅤㅤㅤㅤㅤㅤㅤ

a)

10

b)

20

c)

Syntax Error

d)

10 20

24.

What is the output of this code?

ㅤㅤ

a)

Gaddis,, Tony

b)

Gaddis, Tony

c)

Tony, Gaddis,

d)

Tony, Gaddis

25.

This python code draws _____.

a)

115 stars

b)

200 stars

c)

3 stars

d)

1 star

26.

What is the output of this code?

ㅤㅤ

a)

10 11 12 113 14 15 16 17 18 19 20

b)

11 12 13 14 15 16 17 18 19 20

c)

10

d)

10 11 12 13 14 15 16 17 18 19

27.

What will be the output of the program represented by this flowchart?

ㅤㅤ

a)

1 2 3 4

b)

2 3 4 5

c)

1 2 3 4 5

d)

Nothing is printed

28.

What will this program do?

ㅤㅤ

a)

Print "You got it!" once if the user says "yes" to "Continue?"

b)

Repeatedly get input from the user and print "You got it!" for as long as they input "yes" to "Continue?"

c)

Print "You got it!" in an infinite loop if the user says "yes" to "Continue?"

d)

Nothing is printed

29.

What will this program do?

ㅤㅤ

a)

Print what is returned by get_answers()

b)

Print "Error" if get_answers() returns an empty string, otherwise print answers

c)

Print answers if get_answers() returns an empty string, otherwise print "Error"

d)

Print "Error" followed by answers if get_answers() returns an empty string, otherwise just print answers

30.

What is the output of this code?

a)

catac

b)

cattac

c)

IndexError

d)

Nothing is printed