Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python list TIK

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which is not a definition about lists?

a)

Lists are used to store multiple STRINGS in a single variable.

b)

Lists are used to store multiple ITEMS in a single variable.

c)

Lists are used to store multiple INTIGERS in a single variable.

d)

Lists are used to store multiple ICONS in a single variable.

2.

Which is not a property of the lists?

a)

Allow duplicates

b)

Changeable

c)

Ordered

d)

Unchangeable

3.

Which is the code to print the number of items in the list called "names" in Python:

 names=["era", "beni", "hena","mikael", "ana" ]

a)

print(list)

b)

print(len(list))

c)

cout>>list

d)

cin<<list

4.

Use a range of indexes to print the third, fourth, and fifth item in the list.

fruits = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]

a)

print(fruits[2:5])

b)

print(fruits[:5])

c)

print(fruits[0:5])

d)

print(fruits[5])

5.

Use negative indexing to print the last item in the list.

fruits = ["apple", "banana", "cherry"]

a)

print(fruits[1])

b)

print(fruits[0])

c)

print(fruits[-1])

d)

print(fruits[0:5])

6.

Use the remove method to remove "banana" from the fruits list.

fruits = ["apple", "banana", "cherry"]

a)

fruits.remove

("banana")

b)

fruits.remove

("apple")

c)

fruits.remove

("kiwi")

d)

fruits.remove

("mango")

7.

Change the value from "apple" to "kiwi", in the fruits list.

fruits = ["apple", "banana", "cherry"]

a)

friuts[5]="kiwi"

b)

friuts[2]="kiwi"

c)

friuts[0]="kiwi"

d)

friuts[1]="kiwi"

8.

Use the append method to add "orange" to the fruits list.

fruits = ["apple", "banana", "cherry"]

a)

fruits.append

([1]=orange)

b)

fruits.append

(2=orange)

c)

fruits.append

(1=orange)

d)

fruits.append

("orange")

9.

Use the insert method to add "lemon" as the second item in the fruits list.

fruits = ["apple", "banana", "cherry"]

a)

fruits.insert

(index2,"lemon")

b)

fruits.insert

(1,"lemon")

c)

fruits.insert

(2,"lemon")

d)

fruits.insert

(second,"lemon")

10.

Print the second item in the fruits list.

fruits = ["apple", "banana", "cherry"]

a)

print(friuts<1>)

b)

print(friuts[1])

c)

print(friuts{1})

d)

print(friuts(1))

11.

Which data type are the items of the list below:

list1 = ["apple", "banana", "cherry"]

a)

String

b)

Intiger

c)

Boolean

d)

friuts

12.

Which data type are the items of the list below:

list2 = [1, 5, 7, 9, 3]

a)

text

b)

bytes

c)

Intigers

d)

bits

13.

Which data type are the items of the list below:

list3 = [True, False, False]

a)

Numbers

b)

String

c)

Boolean

d)

Charachter

14.

Which symbols are used to open and close a list?

a)

{ }

b)

[ ]

c)

( )

d)

< >

15.

What is the position of the name "Robert" in the following list?

name=["Bob","Robert","Bobby","Rob"]

a)

0

b)

1

c)

2

d)

3

16.

To print a list called "fruitList" we use:

a)

fruitList.print()

b)

list(print)

c)

friutList(print)

d)

print(fruitList)

17.

Select all the correct options to join two lists in Python

listOne = ['a', 'b', 'c', 'd']

listTwo = ['e', 'f', 'g']

a)

newList = list1 + list1

b)

newList = list2 + list2

c)

newList = listOne + listTwo

d)

newList = list1 + list2

18.

What is the output of the following list function?

sampleList = [10, 20, 30, 40, 50]

sampleList.append(60)

print(sampleList)

a)

[10, 20, 30, 40, 50, 60]

b)

[10, 20, 60, 30, 40, 50,]

c)

[60, 10, 20, 30, 40, 50]

d)

[10, 20, 30, 40, 60, 50]

19.

If list1=[6, 23, 3, 2, 0, 9, 8, 75]

Which of the following will give output as [3, 2, 0]

a)

print(list1[0:5])

b)

print(list1[1:5])

c)

print(list1[2:5])

d)

print(list1[3:5])

20.

___________ method adds one list at the END of another list.

a)

insert( )

b)

append( )

c)

extend( )

d)

join( )

21.

____________function can be used to insert an element/object at a specified index.

a)

insert( )

b)

append( )

c)

extend( )

d)

remove( )

22.

____________function can be used to insert

an element/object at a specified index.

a)

insert( )

b)

append( )

c)

extend( )

d)

remove( )

23.

___________method adds a single item to the end of the list.

a)

insert( )

b)

append( )

c)

extend( )

d)

remove( )

24.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

25.

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

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

NameList(4)

c)

nameList[1]

d)

nameList["4"]

26.

The list needs one more name added to the end - "Felipe".

Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

nameList.append("Felipe")

c)

append(nameList,"Felipe")

d)

nameList.append["Felipe",7]

27.

nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]

The list will be slice and show Harry and Jesse only. Which piece of code below would do this?

a)

print(nameList[1:3])

b)

print(nameList[0:1])

c)

print(nameList[1:2])

d)

print(nameList["Harry":"Jesse"])

28.

To insert an the string "Pedro" in the first position of a the nameList we use:

a)

nameList.append("Pedro, 1")

b)

nameList.insert("Pedro",0)

c)

nameList.insert(1, "Pedro")

d)

nameList.insert(0, "Pedro")

29.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.pop()

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

30.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.remove('Tinian')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

31.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota', 'Guam']

mariana_islands.sort()

print(mariana_islands)

a)

['Guam', 'Tinian', 'Rota', 'Saipan']

b)

['Guam', 'Rota', 'Saipan', 'Tinian']

c)

['Saipan', 'Rota', 'Guam', 'Tinian']

d)

['Tinian', 'Saipan', 'Rota', 'Guam']

32.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.insert(0, 'Guam')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

33.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.append('Guam')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

34.

What is the output of program below?

mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands[3] = 'Guam'

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

35.

What is the output of program below?

mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[-1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

36.

What is the output of program below?

mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

37.

What is the output of the program below?

mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(len(mariana_islands))

a)

4

b)

3

c)

2

d)

1

38.

Given a list numbers=[10,20,30,40,50,60,70,80]

What would numbers[2:6] return?

a)

[10,20,30,40]

b)

[20,30,40,50]

c)

[20,30,40]

d)

[30,40,50,60]

39.

What output will this code produce?

a)

blue

b)

green

c)

red

d)

yellow

40.

What output will this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]