wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CS 1 Cycle 3 exam

Total questions: 30

Worksheet time: 30mins

Name
Class
Date
1.

What will print when this code executes?

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'set'>

d)

<class 'dict'>

2.

What will print when this code executes?

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'set'>

d)

<class 'dict'>

e)

<class 'int'>

3.

What will print when this code executes?

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'set'>

d)

<class 'dict'>

e)

<class 'int'>

4.

What will print when this code executes?

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'set'>

d)

<class 'dict'>

e)

<class 'int'>

5.

Which of the following statements correctly describes the mutability of lists and tuples in Python?

a)

Lists are immutable, while tuples are mutable.

b)

Lists are mutable, while tuples are immutable.

c)

Both lists and tuples are mutable.

d)

Neither lists nor tuples are mutable.

6.

What will print when this code executes?

a)

3

b)

6

c)

8

d)

10

e)

9

7.

What will print when this code executes?

a)

1

b)

4

c)

7

d)

6

e)

9

8.

What will print when this code executes?

a)

[4, 5, 6]

b)

[7, 8, 9]

c)

7

d)

2

e)

[10, 11, 12]

9.

What will print when this code executes?

a)

[4, 5, 6]

b)

[7, 8, 9]

c)

7

d)

2

e)

[10, 11, 12]

10.

Which of the following code snippets will print 5 to the screen, given this list:

my_list=[[2,4,6,8],[1,3,5,7],[0,10,20,30]]

a)

print(my_list[1][2])

b)

print(my_list[0][2])

c)

print(my_list[2][0])

d)

print(my_list[1][1])

e)

print(my_list[0][1])

11.

Which of the list below has the dimensions of 3 X 2 X 3?

a)

b)

c)

d)

12.

Which of the list below has the dimensions of 9 X 2?

a)

b)

c)

d)

13.

Which of the list below has the dimensions of 3 X 4 ?

a)

b)

c)

d)

14.

Who is known as the Father of the Computer?

a)

Alan Turing

b)

Charles Babbage

c)

Grace Hopper

d)

Ada Lovelace

e)

Tim Berners-Lee

15.

Who is known as the First Programmer?

a)

Alan Turing

b)

Charles Babbage

c)

Grace Hopper

d)

Ada Lovelace

e)

Tim Berners-Lee

16.

Who is known as the Queen of Software?

a)

Alan Turing

b)

Charles Babbage

c)

Grace Hopper

d)

Ada Lovelace

e)

Tim Berners-Lee

17.

Who is known as the Father of Computer Science?

a)

Alan Turing

b)

Charles Babbage

c)

Grace Hopper

d)

Ada Lovelace

e)

Tim Berners-Lee

18.

Who is known as the Inventor of the World Wide Web?

a)

Alan Turing

b)

Charles Babbage

c)

Grace Hopper

d)

Ada Lovelace

e)

Tim Berners-Lee

19.

What will be the output to the console for the code below?

for i in range(1,4):

print(i)

a)

1

2

3

b)

1

2

3

4

c)

0

1

2

3

d)

0

1

2

3

4

20.

Which of these will allow me to count from 0-20 in steps of 5?

a)

for x in range(0,20):

print(x)

b)

while x = (0,20,5):

print(x)

c)

for x in range(0,21,5):

print(x)

d)

for x in range(0,21,5):

print(y)

21.

Which of the following best describes the Python def keyword

a)

It's used to defined a class

b)

It's used in conditional statements

c)

It's used to define a function

d)

It's used to delete an object

22.

What will be the output for the program above?

a)

<class 'tuple'>

b)

<class 'list'>

c)

<class 'set'>

d)

<class 'dict'>

23.

Which value is a String?

a)

64

b)

"cat"

c)

True

d)

0.5

24.

Which of these pieces of code would return the name "Isabel" from the following list?

nameList = ["Pedro", "Alex", "Evelyn", "Isabel", "Diego", "Shawn"]

a)

nameList(3)

b)

nameList[3]

c)

NameList["Isabel"]

d)

name[3]

25.

What kind of data structure is user_data in the following declaration?

user_data = {"name": "TJ", "age":24, "user_name":"artLover123"}

a)

List

b)

Tuple

c)

Range

d)

Dictionary

26.

Which of the following code snippets will create this 2D list?

[

[1, 2, 3],

[4, 5, 6],

[7, 8, 9]

]

a)

board = [1, 2, 3] + [4, 5, 6] + [7, 8, 9]

b)

board = [1, 2, 3]

board.append([4, 5, 6])

board.append([7, 8, 9])

c)

board = [1, 2, 3, 4, 5, 6, 7, 8, 9]

d)

board = []

board.append([1, 2, 3])

board.append([4, 5, 6])

board.append([7, 8, 9])

27.

What does “packing” refer to in Python?

a)

Creating a list

b)

Initializing variables using values from a list

c)

Storing multiple variables’ values by putting them in a collection, like a list or tuple

d)

Cramming as many commands as possible onto a single line

28.

What does “unpacking” refer to in Python?

a)

Initializing multiple variables at a time using a collection of values

b)

Storing multiple variables’ values by putting them in a collection, like a list or tuple

c)

Cramming as many commands as possible onto a single line

d)

Creating a list

29.

Which of the following assignment statements is equivalent to the following code snippet?

red, blue, green = "BLUE", "GREEN", "RED"

a)

red = "BLUE"

blue = "GREEN"

green = "RED"

b)

red = ["BLUE", "GREEN", "RED"]

blue = ["BLUE", "GREEN", "RED"]

green = ["BLUE", "GREEN", "RED"]

c)

red = "RED"

blue = "BLUE"

green = "GREEN"

d)

red = "BLUE"

blue = "BLUE"

green = "BLUE"

30.

What is the output of this program?

a)

tree

flower

weed

b)

tree : oak

flower : daisy

weed : bindweed

c)

oak

daisy

bindweed

d)

tree oak

flower daisy

weed bindweed