wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Second Day Quiz!

Total questions: 11

Worksheet time: 8mins

Name
Class
Date
1.

Which one below is a list?

a)

list

b)

2

c)

["hi", "I", "Am", "Bernard"]

d)

(1, 2, 3)

e)

{1: "1", 2: "2", 3: "3"}

2.

a = [9, 3, 23, 84]

print(a[i])

what should be the value of i in order to get 23?

a)

0

b)

1

c)

2

d)

4

3.

What is the main difference between a list and a tuple?

a)

Tuple is slower, list is faster

b)

Tuple is uglier, list is prettier

c)

Tuples take less space than lists

d)

A tuple is mutable, while a list is immutable

4.

fav_foods = {"Japanese": "Sushi", "Chinese": "Chicken Rice", "Malay": "Nasi Lemak", "Indian": "Roti Canai"}

How do I get my favorite Malay food from this dictionary?

a)

fav_foods[2]

b)

fav_foods[3]

c)

fav_foods["Nasi Lemak"]

d)

fav_foods["Malay"]

5.

What's wrong with this?

b = [[1,2,3], [4,5,6]]

a)

It has two list in a list

b)

it doesn't have semicolon at the end lol

c)

Nothing's wrong

d)

b is a bad name

6.

How do I change the value of the first element into "D"?

a = ["A", "B", "C"]

a)

a = "D"

b)

a[0] = "D"

c)

a["A"] = "D"

d)

a[1] = "D"

7.

what will happen?

a = 5

del a

print(a)

a)

5 will be printed out

b)

del is not defined before

c)

will raise a definition error saying that a is undefined

d)

a has been deleted but it can still be printed out

8.

Which of the following statements are right?

a)

Python is a language that's based on indentation to classify "blocks"

b)

Condition can either be True or False

c)

The "Blocks" inside if and while loop will only run when their conditions are True

d)

for loop will run for a specified time, but while loop will run as long as the condition is true

9.

what will be printed?

(a)  

10.

a = 0

for i in range(999):

a += 1

What is a after the for loop?

a)

999

b)

998

c)

1000

d)

1001

11.

What is this?

a)

The money will decrease by 1 at the start of the loop, and increase by 40 at the end of the loop because the keyword continue asks the program to continue after line 7

b)

The loop will always print "I still have money!"

c)

The loop will keep decreasing the money by 1, it wouldn't run the code after line 8 because of continue, but when the money is less than 10 it will increase by 40

d)

money is infinity