wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python_List_11

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.

What is the output of Following code?

List = ['spam', 2.0, 5, [10, 20]]

print(List[2])

(a)  

2.

What is the output of Following code?

cheeses = ['Cheddar', 'Edam', 'Gouda']

numbers = [42, 123]

print(cheeses, numbers)

a)

['Cheddar', 'Edam', 'Gouda'] [42, 123]

b)

[42, 123] ['Cheddar', 'Edam', 'Gouda']

c)

Compilation Error

d)

No output

3.

What is output of the following Code (Execute in Intrepreter)

cheeses = ['Cheddar', 'Edam', 'Gouda']

'Edam' in cheeses

(a)  

4.

In Python, list is mutable

a)

True

b)

False

5.

Which of the following commands will create a list?

a)

list1 = list()

b)

list1 = []

c)

list1 = list([1, 2, 3])

d)

list1 = new List()

6.

What is the output of the following code?

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

print(list[1:2])

(a)  

7.

What is the output of the following code?

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

print(list[2:1])

(a)  

8.

What is the output of the following code?

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

print(list[::-1])

a)

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

b)

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

c)

Error

d)

No output

9.

What is the output of the following code?

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

print(list[::-3])

a)

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

b)

Compilation error

c)

[8,9,10]

d)

[10, 7, 4, 1]

10.

What is the output of the following code?

list = []

list.append(1)

list.append(2.0)

list.append("vk")

print(list)

a)

[1, 2.0, 'vk']

b)

Error

c)

['vk', 1, 2.0]

d)

No putput

11.

Select the right translation of the word “array”

a)

Элемент

b)

Массив

c)

Мәні

d)

Жол

12.

Select the right translation of the word “value”

a)

Шама

b)

Көлем

c)

Жылдамдық

d)

Массив

13.

Әр түрлі типтегі объектілерді жинауға арналған деректер құрылымы.

a)

Индекс

b)

Мәліметтер

c)

Элемент

d)

Тізім

14.

List indices start at _______.

a)

1

b)

2

c)

0

d)

3

15.

Select the right translation of the word “кірістіру”

a)

insert

b)

choose

c)

output

d)

print

16.

Select the right translation of the word “кеңейту”

a)

insert

b)

extend

c)

add

d)

element

17.

Which function uses to add elements to the list?

a)

addition

b)

multiplication

c)

append

d)

application

18.

Which method is used to add multiple elements at the same time at the end of the list

a)

extend

b)

append

c)

insert

d)

addition

19.

Which method is used to add element at the desired position?

a)

extend

b)

append

c)

position

d)

insert

20.

Select the output of the program code:

List=['Python', 'List']

for i in range(1, 4):

List.append(i)

print(List)

a)

['Python', 'List']

b)

['Python', 'List', 1, 2, 3, 4]

c)

['Python', 'List', 1, 2, 3]

d)

['Python', 'List', 0, 1, 2, 3, 4]

21.

Which of these is the best description of a list in Python?

a)

A list is a collection of data that has an order and can be changed

b)

A list is a lot of variables

c)

A list is used for shopping

d)

A list is a collection of data that cannot hold duplicated data and cannot be changed

22.

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]

23.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

24.

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[1]

c)

NameList(4)

d)

nameList["4"]

25.

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)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

26.

Which of these is a list?

a)

fruit = ["pineapples", "mangoes", "bananas"]

b)

fruit = "pineapples", "mangoes", "bananas"

c)

fruit = {"pineapples", "mangoes", "bananas"}

d)

fruit = ("pineapples", "mangoes", "bananas")

27.

If you want to create an empty list called islands, which of the following pieces of code is correct?

a)

islands = { }

b)

islands = ( )

c)

islands = [ ]

d)

islands = < >

28.

Each item in a list has an "address" or index. The first index in a Python list is what?

a)

1

b)

0

c)

a

d)

A

29.

What is the index of the name 'Paula' in the following list:

names = ["Paul","Phillip","Paula","Phillipa"]

a)

0

b)

1

c)

2

d)

3

30.
What is the output when we execute list(“hello”)?
a)
[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
b)
 [‘hello’] 
c)
[‘llo’]
d)
 [‘olleh’]
31.

What is the output of program below?


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

del mariana_islands[0]

print(mariana_islands)

a)

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

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

32.

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']

33.

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']

34.

What is the output of program below?


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

mariana_islands.sort()

print(mariana_islands)

a)

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

b)

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

c)

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

d)

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

35.

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']

36.

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']

37.

What is the output of program below?


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

mariana_islands[0] = 'Guam'

print(mariana_islands)

a)

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

b)

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

c)

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

d)

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

38.

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

39.

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

40.

What is the output of the program below?


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

cmni = mariana_islands[1:]

len(cmni)

a)

1

b)

2

c)

3

d)

4

41.

Which of these is the best description of a list in Python?

a)

A list is a collection of data that has an order and can be changed

b)

A list is a lot of variables

c)

A list is used for shopping

d)

A list is a collection of data that cannot hold duplicated data and cannot be changed

42.

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]

43.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

44.

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[1]

c)

NameList(4)

d)

nameList["4"]

45.

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)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

46.

Which of these is a list?

a)

fruit = ["pineapples", "mangoes", "bananas"]

b)

fruit = "pineapples", "mangoes", "bananas"

c)

fruit = {"pineapples", "mangoes", "bananas"}

d)

fruit = ("pineapples", "mangoes", "bananas")

47.

If you want to create an empty list called islands, which of the following pieces of code is correct?

a)

islands = { }

b)

islands = ( )

c)

islands = [ ]

d)

islands = < >

48.

Each item in a list has an "address" or index. The first index in a Python list is what?

a)

1

b)

0

c)

a

d)

A

49.

What is the index of the name 'Paula' in the following list:

names = ["Paul","Phillip","Paula","Phillipa"]

a)

0

b)

1

c)

2

d)

3

50.
What is the output when we execute list(“hello”)?
a)
[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
b)
 [‘hello’] 
c)
[‘llo’]
d)
 [‘olleh’]
51.

What is the output of program below?


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

mariana_islands[0] = 'Guam'

print(mariana_islands)

a)

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

b)

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

c)

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

d)

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

52.

Which of these is the best description of a list in Python?

a)

A list is a collection of data that has an order and can be changed

b)

A list is a lot of variables

c)

A list is used for shopping

d)

A list is a collection of data that cannot hold duplicated data and cannot be changed

53.

What is the output of Following code?

List = ['spam', 2.0, 5, [10, 20]]

print(List[2])

(a)  

54.

What is the output of the following code?

list = []

list.append(1)

list.append(2.0)

list.append("vk")

print(list)

a)

[1, 2.0, 'vk']

b)

Error

c)

['vk', 1, 2.0]

d)

No putput

55.
What will the following code result in:

name = “Alison”
number = len(name)
print(number)
a)
4
b)
5
c)
6
d)
7
56.

num1 = app.getTextInput('Give me a one digit number')


If the user enters the number 7, what is stored in memory?

a)

'7'

b)

7

57.

num1 = 7

num2 = 3

sum = num1 + num2

answer = 'The sum of the two numbers is ' + ......

Which of the following should replace .... ?

a)

sum

b)

str(sum)

c)

num1 + num2

d)

all of these should work

58.

alphabet = 'abcdefghijklmnopqrstuvwxyz'


letter = alphabet[1]

what is the value of letter?

a)

a

b)

b

c)

can't tell

59.

T/F - It is possible to use an index to access a member of a group.

a)

True

b)

False

60.

T/F A list can contain a group.

a)

True

b)

False