wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 1 Review - Python Programming

Total questions: 35

Worksheet time: 53mins

Name
Class
Date
1.

Determine the output:

a)

o

b)

n

c)

t

d)

e

2.

Determine the output. Note, hello is not a variable name.

a)

hello

b)

'hello'

c)

(hello)

d)

this will result in an error

3.

Determine the output.

a)

hello

b)

print

c)

(hello)

d)

this will result in an error

4.

Which of the following will correctly print:

Justin Bieber is 27 years old.

a)
b)
c)
d)
5.

Determine the output.

a)

"hello"

b)

hello

c)

< class 'str' >

d)

'hello'

6.

Determine the output.

a)

['hello', 7, 9.5]

b)

hello

c)

9.5

d)

< class 'list' >

7.

Determine the output.

a)

9.5

b)

< class 'int' >

c)

< class 'float' >

d)

this will result in an error

8.
a)

['hello', 7. 9.5]

b)

hello, 7, 9.5

c)

< class 'list' >

d)

< class 'float' >

9.

Determine the output.

a)

['sweater', 'jeans', 't-shirts', 'long sleeved shirts']

b)

['long sleeved shirts', 'sweater', 'jeans', 't-shirts']

c)

['sweater', 'jeans', 'long sleeved shirts']

d)

['jeans', 'long sleeved shirts', 'sweater', 't-shirts']

10.

Which of the following will correctly replace "jeans" with "black pants" ?

a)

new_clothes.append("black pants")

b)

new_clothes[2] = "black pants"

c)

new_clothes[1] = "black pants"

d)

new_clothes.insert(2, "black pants")

11.

Which of the following will correctly arrange the items in the new_clothes list in alphabetical order?

a)

new_clothes.replace()

b)

new_clothes.reverse()

c)

new_clothes.append()

d)

new_clothes.sort()

12.

Which of the following will correctly arrange the items in the new_clothes lists in descending order (reverse alphabetical order)?

a)

new_clothes.order()

b)

new_clothes.reverse()

c)

new_clothes.sort()

new_clothes.reverse()

d)

new_clothes.sort()

13.

Determine the output if the user entered Joe Exotic for name and 176 for num_pets.

a)

Joe Exotic has 176 pets.

b)

JoeExotichas176pets.

c)

Joe Exotic + has + 176 + pets.

d)

this will result in an error.

14.

All of the following will correctly print:

Joe Exotic has 176 pets.

except for...

a)
b)
c)
d)
15.

If the user enters 7 for num1 and 5 for num2, determine the output.

a)

num_sum

b)

12

c)

75

d)

this will result in an error

16.

If the user enters 7 for num1 and 5 for num2, determine the output.

a)

num_sum

b)

12

c)

75

d)

this will result in an error

17.

Determine the output.

a)

5 6 5

b)

4 4 4

c)

4 5 5

d)

5 5 5

18.

What value is stored in expression?

a)

91

b)

153

c)

27

d)

33

19.

What is the value stored in expression?

a)

2

b)

7

c)

3

d)

-7

20.

What is the value stored in expression?

a)

9

b)

2

c)

0

d)

0.5

21.

What is the value stored in expression?

a)

4.5

b)

1

c)

0

d)

7

22.

What is the value stored in expression?

a)

0.5

b)

8.0

c)

0.125

d)

5.0

23.

Determine the output if the user enters 100 when asked to enter a side length.

a)
b)
c)
d)

this will result in an error

24.

Which of the following is the correct output when the code is executed? Note, the turtle is initially at home.

a)
b)
c)
d)
25.

Which of the following would produce this image?

a)
b)
c)
d)
26.

Which of the following is the correct output if the user enters 100 when asked to enter a number?

a)
b)
c)
d)
27.

What is the value stored in variable b ?

a)

6

b)

3

c)

19

d)

"a"

28.

Suppose the user entered 5 when asked to enter a number. Determine the output when the code segment is executed

a)

7

b)

5

c)

6.25

d)

this will result in an error

29.

Suppose the user entered 5 when asked to enter a number. Determine the output when the code segment is executed

a)

7

b)

5

c)

6.25

d)

this will result in an error

30.

Determine the output when the code segment below is executed:

print(11 // 2)

a)

5.5

b)

5

c)

1

d)

0

31.

Determine the output when the code below is executed:

movie = "BARBIE"

word = ""

word += movie[0]

word += movie[1]

word += movie[5]

print(word)

a)

E

b)

BAI

c)

BAE

d)

word

32.

Determine the output when the code segment is executed:

ages = [10, 11, 12]

grades = [5, 6, 7]

num1 = ages[1]

num2 = grades[2]

print(num1 + num2)

a)

18

b)

77

c)

16

d)

117

33.

Determine the output when the code segment is executed:

ages = [10, 11, 12]

grades = [5, 6, 7]

num1 = ages[2]

num2 = grades[1]

print(num1 % num2)

a)

2

b)

0

c)

1

d)

2.0

34.

Determine the output:

value = (6 % 4 + 1) ** 2

print(value)

a)

6

b)

9

c)

6.25

d)

5

35.

Determine the output when the code segment below is executed:

scores = [84, 91, 100, 75, 80, 95]

scores.append(87)

num = len(scores)

value = scores[2] - num

print(value)

a)

84

b)

85

c)

93

d)

94