WorksheetsPython_List_11
Total questions: 60
Worksheet time: 30mins
What is the output of Following code?
List = ['spam', 2.0, 5, [10, 20]]
print(List[2])
(a)
What is the output of Following code?
cheeses = ['Cheddar', 'Edam', 'Gouda']
numbers = [42, 123]
print(cheeses, numbers)
['Cheddar', 'Edam', 'Gouda'] [42, 123]
[42, 123] ['Cheddar', 'Edam', 'Gouda']
Compilation Error
No output
What is output of the following Code (Execute in Intrepreter)
cheeses = ['Cheddar', 'Edam', 'Gouda']
'Edam' in cheeses
(a)
In Python, list is mutable
True
False
Which of the following commands will create a list?
list1 = list()
list1 = []
list1 = list([1, 2, 3])
list1 = new List()
What is the output of the following code?
list = [1,2,3,4,5,6,7,8,9,10]
print(list[1:2])
(a)
What is the output of the following code?
list = [1,2,3,4,5,6,7,8,9,10]
print(list[2:1])
(a)
What is the output of the following code?
list = [1,2,3,4,5,6,7,8,9,10]
print(list[::-1])
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
[1,2,3,4,5,6,7,8,9,10]
Error
No output
What is the output of the following code?
list = [1,2,3,4,5,6,7,8,9,10]
print(list[::-3])
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
Compilation error
[8,9,10]
[10, 7, 4, 1]
What is the output of the following code?
list = []
list.append(1)
list.append(2.0)
list.append("vk")
print(list)
[1, 2.0, 'vk']
Error
['vk', 1, 2.0]
No putput
Select the right translation of the word “array”
Элемент
Массив
Мәні
Жол
Select the right translation of the word “value”
Шама
Көлем
Жылдамдық
Массив
Әр түрлі типтегі объектілерді жинауға арналған деректер құрылымы.
Индекс
Мәліметтер
Элемент
Тізім
List indices start at _______.
1
2
0
3
Select the right translation of the word “кірістіру”
insert
choose
output
Select the right translation of the word “кеңейту”
insert
extend
add
element
Which function uses to add elements to the list?
addition
multiplication
append
application
Which method is used to add multiple elements at the same time at the end of the list
extend
append
insert
addition
Which method is used to add element at the desired position?
extend
append
position
insert
Select the output of the program code:
List=['Python', 'List']
for i in range(1, 4):
List.append(i)
print(List)
['Python', 'List']
['Python', 'List', 1, 2, 3, 4]
['Python', 'List', 1, 2, 3]
['Python', 'List', 0, 1, 2, 3, 4]
Which of these is the best description of a list in Python?
A list is a collection of data that has an order and can be changed
A list is a lot of variables
A list is used for shopping
A list is a collection of data that cannot hold duplicated data and cannot be changed
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
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"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
Which of these is a list?
fruit = ["pineapples", "mangoes", "bananas"]
fruit = "pineapples", "mangoes", "bananas"
fruit = {"pineapples", "mangoes", "bananas"}
fruit = ("pineapples", "mangoes", "bananas")
If you want to create an empty list called islands, which of the following pieces of code is correct?
islands = { }
islands = ( )
islands = [ ]
islands = < >
Each item in a list has an "address" or index. The first index in a Python list is what?
1
0
a
A
What is the index of the name 'Paula' in the following list:
names = ["Paul","Phillip","Paula","Phillipa"]
0
1
2
3
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
del mariana_islands[0]
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Tinian', 'Rota']
['Saipan', 'Tinian']
['Saipan', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands.pop()
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Tinian', 'Rota']
['Saipan', 'Tinian']
['Saipan', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands.remove('Tinian')
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Tinian', 'Rota']
['Saipan', 'Tinian']
['Saipan', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota', 'Guam']
mariana_islands.sort()
print(mariana_islands)
['Tinian', 'Saipan', 'Rota', 'Guam']
['Guam', 'Tinian', 'Rota', 'Saipan']
['Saipan', 'Rota', 'Guam', 'Tinian']
['Guam', 'Rota', 'Saipan', 'Tinian']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands.insert(0, 'Guam')
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Guam', 'Tinian', 'Rota']
['Saipan', 'Tinian', 'Rota', 'Guam']
['Guam', 'Saipan', 'Tinian', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands.append('Guam')
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Guam', 'Tinian', 'Rota']
['Saipan', 'Tinian', 'Rota', 'Guam']
['Guam', 'Saipan', 'Tinian', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands[0] = 'Guam'
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Guam', 'Tinian', 'Rota']
['Saipan', 'Tinian', 'Rota', 'Guam']
['Guam', 'Saipan', 'Tinian', 'Rota']
What is the output of program below?
mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']
print(mariana_islands[-1])
Guam
Saipan
Tinian
Rota
What is the output of program below?
mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']
print(mariana_islands[1])
Guam
Saipan
Tinian
Rota
What is the output of the program below?
mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']
cmni = mariana_islands[1:]
len(cmni)
1
2
3
4
Which of these is the best description of a list in Python?
A list is a collection of data that has an order and can be changed
A list is a lot of variables
A list is used for shopping
A list is a collection of data that cannot hold duplicated data and cannot be changed
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
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"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
Which of these is a list?
fruit = ["pineapples", "mangoes", "bananas"]
fruit = "pineapples", "mangoes", "bananas"
fruit = {"pineapples", "mangoes", "bananas"}
fruit = ("pineapples", "mangoes", "bananas")
If you want to create an empty list called islands, which of the following pieces of code is correct?
islands = { }
islands = ( )
islands = [ ]
islands = < >
Each item in a list has an "address" or index. The first index in a Python list is what?
1
0
a
A
What is the index of the name 'Paula' in the following list:
names = ["Paul","Phillip","Paula","Phillipa"]
0
1
2
3
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands[0] = 'Guam'
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Guam', 'Tinian', 'Rota']
['Saipan', 'Tinian', 'Rota', 'Guam']
['Guam', 'Saipan', 'Tinian', 'Rota']
Which of these is the best description of a list in Python?
A list is a collection of data that has an order and can be changed
A list is a lot of variables
A list is used for shopping
A list is a collection of data that cannot hold duplicated data and cannot be changed
What is the output of Following code?
List = ['spam', 2.0, 5, [10, 20]]
print(List[2])
(a)
What is the output of the following code?
list = []
list.append(1)
list.append(2.0)
list.append("vk")
print(list)
[1, 2.0, 'vk']
Error
['vk', 1, 2.0]
No putput
name = “Alison”
number = len(name)
print(number)
num1 = app.getTextInput('Give me a one digit number')
If the user enters the number 7, what is stored in memory?
'7'
7
num1 = 7
num2 = 3
sum = num1 + num2
answer = 'The sum of the two numbers is ' + ......
Which of the following should replace .... ?
sum
str(sum)
num1 + num2
all of these should work
alphabet = 'abcdefghijklmnopqrstuvwxyz'
letter = alphabet[1]
what is the value of letter?
a
b
can't tell
T/F - It is possible to use an index to access a member of a group.
True
False
T/F A list can contain a group.
True
False
