wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ALTSCHOOL AFRICA CIRCLE 7 (23/8/25)

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is the index of the first element in a Python list?


a)

0

b)

1

c)

-1

d)

None

2.

Which of the following creates a list in Python?


a)

list = (1,2,3)

b)

list = {1,2,3}

c)

list = <1,2,3>

d)

list = [1,2,3]

3.
  1. Which method adds an item to the end of a list?




a)
  1. insert()

b)
  1. extend()

c)
  1. add()

d)
  1. append()

4.
  1. What will len([10, 20, 30]) return?




a)
  1. 4

b)
  1. 2

c)
  1. 3

d)
  1. Error

5.
  1. Which of these will remove the first occurrence of 20 from [10, 20, 30, 20]?

a)

list.pop(20)

b)
  1. list.delete(20)

c)
  1. list.discard(20)

d)
  1. list.remove(20)

6.
  1. hat is the output of x = [[1,2],[3,4]]; print(x[1][0])?

a)
  1. 3

b)
  1. 4

c)
  1. 2

d)
  1. 1

7.
  1. Which of the following correctly defines a nested list?

a)
  1. [1,2,3,4]

b)
  1. [1, [2, 3], 4]

c)
  1. [[1,2,3,4]]

d)
  1. Both B and C

8.

What will x = [[10,20],[30,40]]; print(len(x)) return?



a)

3

b)

2

c)

4

d)

Error

9.
  1. Which statement accesses the value 20 in y = [[10, 20], [30, 40]]?

a)
  1. y[0][0]

b)

y[1][0]

c)
  1. y[0][1]

d)

  1. y[1][1]

10.
  1. What is the output of z = [[1,2,3],[4,5]]; print(z[1][1])?

a)
  1. 2

b)
  1. 3

c)
  1. 4

d)
  1. 5

11.
  1. What does Python use to define code blocks?




a)
  1. Semicolons

b)
  1. Braces {}

c)
  1. Parentheses ()

d)
  1. Indentation

12.
  1. What will happen if indentation is not consistent in Python?

a)
  1. Program runs normally

b)
  1. IndentationError occurs

c)
  1. SyntaxWarning occurs

d)
  1. Nothing happens

13.
  1. Tuples in Python are:

a)

Mutable

b)

Immutable

c)

Dynamic

d)

Error-prone

14.
  1. Which of the following is an indentation error?

a)
  1. if True: print('Hello')

b)
  1. if True: print('Hello')

c)
  1. Both A and B

d)
  1. None

15.
  1. What is the default number of spaces used in Python indentation (by convention)?

a)
  1. 2

b)
  1. 3

c)
  1. 4

d)
  1. 5

16.
  1. Which error occurs if you mix tabs and spaces in indentation?




a)
  1. SyntaxError

b)
  1. TypeError

c)
  1. RuntimeError

d)
  1. IndentationError

17.
  1. Which of these creates a tuple?

a)
  1. t = (1,2,3)

b)
  1. t = [1,2,3]

c)
  1. t = {1,2,3}

d)
  1. t = <1,2,3>

18.
  1. Which method is not available for tuples?

a)
  1. count()

b)
  1. index()

c)
  1. append()

d)
  1. remove()

19.
  1. What will t = (10,); print(type(t)) output?

a)
  1. <class 'int'>

b)
  1. <class 'tuple'>

c)
  1. <class 'list'>

d)
  1. Error

20.
  1. What is the output of (1,2,3) + (4,5)?

a)
  1. (1,2,34,5)

b)
  1. (1,2,3,4,5)

c)
  1. [1,2,3,4,5]

d)
  1. Error

21.
  1. What is the output of:
    x = 10

    if x > 5:

    print("A")

    else:

    print("B")

a)
  1. A

b)
  1. B

c)
  1. Error

d)

  1. None

22.
  1. Which of the following is valid?

a)
  1. if x > 10 then:

b)
  1. if (x > 10):

c)
  1. if x > 10:

d)
  1. Both B and C

23.

In an if-elif-else statement, when does else block run?

a)

Only if first condition is true

b)

Always

c)

Never

d)

Only if all previous conditions are false

24.

What will this code print?

x = 0

if x:

print("Yes")

else:

print("No")

a)

Yes

b)

No

c)

Error

d)

None

25.

What will print(type(True)) output?

a)

<class 'int'>

b)

<class 'bool'>

c)

<class 'str'>

d)

<class 'NoneType'>