wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ALTSCHOOL QUIZ 13/9/25

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is the correct syntax for an if-elif-else block?

a)

if - elif - else

b)

when - otherwise

c)

do - if - end

d)

switch - case - end

2.

Which method is used to remove the last item in a list?

a)

remove()

b)

pop()

c)

delete()

d)

clear()

3.

What will be the output of my_list = [1, 2, 3]; print(my_list[1])?

a)

1

b)

2

c)

3

d)

Error

4.

Which method is used to retrieve all keys in a dictionary?

a)

get()

b)

items()

c)

keys()

d)

values()

5.

What is the correct way to create a dictionary in Python?

a)

my_dict = []

b)

my_dict = ()

c)

my_dict = {}

d)

my_dict = <>

6.

Which of the following defines a function with two parameters?

a)

def myFunc[]:

b)

def myFunc(x, y):

c)

myFunc def(x y):

d)

D. def myFunc:

7.

What does a function return if there is no return statement?

a)

0

b)

False

c)

None

d)

Null

8.

What keyword is used to define a function in Python?

a)

function

b)

def

c)

define

d)

fun

9.

What is the output of for i in range(3): print(i)?

a)

1 2 3

b)

0 1 2

c)

0 1 2 3

d)

Error

10.

Which method removes an element without error if it’s not present?

a)

remove()

b)

B. discard()

c)

C. pop()

d)

D. delete()

11.

What happens if you try to add a duplicate to a set?

a)

It adds the item again

b)

It creates an error

c)

The set stays unchanged

d)

It creates a list

12.

What is the output of type (set())?

a)

dict

b)

list

c)

tuple

d)

set

13.

How do you remove all elements from a set?

a)

clear()

b)

del()

c)

removeAll()

d)

empty()

14.

What does set1 & set2 return?

a)

Union

b)

Difference

c)

Intersection

d)

Symmetric Difference

15.

Which operator is used for union of two sets?

a)

&

b)

|

c)

^

d)

+

16.

What will len (set([1, 2, 2, 3])) return?

a)

4

b)

2

c)

3

d)

Error

17.

Which method adds an element to a set?

a)

append()

b)

insert()

c)

add()

d)

extend()

18.

What makes a set different from a list?

a)

Sets are ordered

b)

Sets allow duplicates

c)

Sets are immutable

d)

Sets don’t allow duplicates

19.

Ho do you create a set in python

a)

set = []

b)

set = {}

c)

set = set([])

d)

set = {1, 2, 3}

20.

What will the expression len([1, 2, 3, 4]) return?

a)

Error

b)

5

c)

4

d)

3

21.

What does the method pop() do when called on a list?

a)

Clears the list

b)

Returns the list

c)

Removes the last item

d)

Removes the first item

22.

Which of the following is a valid way to create a tuple in Python?

a)

my_tuple = < >

b)

my_tuple = ()

c)

my_tuple = []

d)

my_tuple = {}

23.

What is the output of print(type({1, 2, 3}))?

a)

set

b)

list

c)

dict

d)

tuple

24.

How do you check if an item exists in a set?

a)

check(item) in set

b)

item.exists(set)

c)

set.contains(item)

d)

item in set

25.

What will be the output of my_set = {1, 2, 3}; my_set.add(2); print(my_set)?

a)

{1, 2, 2, 3}

b)

Error

c)

{1, 2, 3}

d)

{1, 3}