wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Lists, Subroutines and Sequence in Pseudocode - Python

Total questions: 14

Worksheet time: 11mins

Name
Class
Date
1.

What will the following code output? Enter your answer.

NumberList = [ 1, 5, 7, 4, 5, 1, 9, 9 ] 

print(NumberList[3])

(a)  

2.

What will the following code output?

NumberList = [ 1, 5, 7, 4, 5, 1, 9, 9 ] 

Length = len(NumberList)

print(Length)

a)

7

b)

8

c)

9

d)

6

3.

What will the following code output? Enter your answer.

NumberList = [ 1, 5, 7, 4, 5, 1, 9, 9 ] 

print(NumberList[1:4])

a)

1

5

7

4

b)

5

7

4

c)

5

7

4

5

d)

1

5

7

4

5

4.

In regards to a type of array called lists, what does the append method do?

a)

Adds a single item to a list.

b)

Removes a single item from a list.

c)

Randomly shuffles all items in a list.

d)

Creates a new list.

5.

Enter the name of the module or library you would want to use for drawing shapes and patterns in Python.

(a)  

6.

What is the maximum number this program can randomly output?

import random

print(random.randrange(0, 1000))

a)

10000

b)

1000

c)

999

d)

1001

7.

This type of subroutine passes and returns values.

What am I?

a)

Procedure

b)

Function

8.

Enter the exact code missing in LINE 3 to call this procedure

(a)  

9.

If the input value for variable toSquare is 5, what result will this function return?

a)

25

b)

10

c)

y

d)

x

10.

In pseudocode which symbol can we use to replace assignment =

a)

b)

= =

c)

d)

<

11.

What will this Pseudocode output? Enter your answer

A  ← 100

B  ← 100

X A - B

PRINT X

(a)  

12.

What will this Pseudocode output?

A ← 1

B ← 4

A ← 4

X ← A + A

PRINT X

a)

8

b)

2

c)

1

d)

5

13.

Casting is not applied in Pseudocode.

a)

True

b)

False

14.

On a scale 1 to 10 (10 being very easy) how have you found Python programming so far?

4 lines