Question 1
A Python list is .. set of items.
an unordered
an ordered
a limited
an integer
Question 2
Which is a valid Python statement?
alist = [1; 4; 9; 16]
alist = 1: 2: 3: 4]
alist = [1, 4, 9, 16]
Question 3
A Python list's items can be any Python type.
True
False
Question 4
If squares = [1, 4, 9, 16], what is the value of squares(1] ?
an error
1
4
5
Question 5
If squares = [1, 4, 9, 16, 25], what is len(squares)?
4
55
5
1
Question 6
The following statement is valid:
alist = [ ]
True
False
Question 7
What is the output of the following program:
alist = []
for i in range(3):
alist.append(i**2)
print(alist)
[1, 4, 16]
[ ]
[0,1,4]
9
Question 8
What is the output of the following:
alist = [1, 4, 9]
sum = 0
for value in alist:
sum += value
print(sum)
[1, 5, 14]
0
14
[1, 4, 9]
Question 9
If squares = [1, 4, 9, 16, 25], what is the value of squares[1:3] ?
[4,91
[4, 9, 16]
[1,4]
[1, 4, 9]
Question 10
If squares = [1, 4, 9, 16, 25], what is the value of squares[:3] ?
[1, 4, 9, 16]
an error
[1, 4, 9]
Question 11
If squares = [1, 4, 9, 16, 25], what is the value of squares[2:]?
[4,9, 16, 25]
an error
[1. 41
[9, 16, 25]
Question 12
If squares = [1, 4, 9, 16, 25], what is the value of squares[0::2] ?
[1, 4]
an error
[1, 9, 25]
[1, 4, 9]
Question 13
What function can be used to determine the smallest value in a list?
smallest()
min()
least()
minimum()
Question 14
Which keyword is used to determine if a value is in a list?
contains
in
has
within
Question 15
Assuming alist is a list of 4 items, what does this statement do:
alist[11 = 2
Insert two items into the list at position 1
Change alist's second item to 2
Change alist's first item to 2
Insert an item in a list at position 1 with value 2
Question 16
Which statement can be used to insert an item into a list named alist?
alist.insert(item, O)
insert(alist, item)
alist.insert(O, item)
alist <- item
Question 17
What method can be used to append a list to the end of another list?
augment()
extend()
concatenate()
add()
Question 18
Assuming the list squares is set to [1, 4, 9, 16], what statement can be
used to remove the value 1 from the list
del alist.0
alist.remove(1)
remove(alist, 1)
remove(alist, O)
Ouestion 19
Assuming alist is a list with 4 items, what statement can be used to
remove the last item from alist and assignment the variable last to its
value?
last = alist.pop()
last = alist.drop()
last = alist[-1]
last = alist[0]
Question 20
What statement can be used to remove all items from a list named alist?
delete alist
alist.clear()
del alist
clear(alist)
Question 21
What statement can be used to remove the first item from a list named
alist?
remove(alist, 0)
alist.remove(O)
del alist[O]
del(alist, O)
Question 22
If alist is a list, what method can be used to create a new list with a copy
of the items contained in alist?
blist = alist.dup()
blist = alist
copy(alist, blist)
blist = alist.copy()
Question 23
If alist is a list, what does sorted(alist) do?
generates a new ordered list
checks if alist is.
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Question 1A Python list is ��.. set of items.an unorderedan or.pdf
1. Question 1
A Python list is .. set of items.
an unordered
an ordered
a limited
an integer
Question 2
Which is a valid Python statement?
alist = [1; 4; 9; 16]
alist = 1: 2: 3: 4]
alist = [1, 4, 9, 16]
Question 3
A Python list's items can be any Python type.
True
False
Question 4
If squares = [1, 4, 9, 16], what is the value of squares(1] ?
an error
1
4
5
Question 5
If squares = [1, 4, 9, 16, 25], what is len(squares)?
4
55
5
1
Question 6
The following statement is valid:
alist = [ ]
2. True
False
Question 7
What is the output of the following program:
alist = []
for i in range(3):
alist.append(i**2)
print(alist)
[1, 4, 16]
[ ]
[0,1,4]
9
Question 8
What is the output of the following:
alist = [1, 4, 9]
sum = 0
for value in alist:
sum += value
print(sum)
[1, 5, 14]
0
14
[1, 4, 9]
Question 9
If squares = [1, 4, 9, 16, 25], what is the value of squares[1:3] ?
[4,91
[4, 9, 16]
[1,4]
[1, 4, 9]
Question 10
If squares = [1, 4, 9, 16, 25], what is the value of squares[:3] ?
[1, 4, 9, 16]
3. an error
[1, 4, 9]
Question 11
If squares = [1, 4, 9, 16, 25], what is the value of squares[2:]?
[4,9, 16, 25]
an error
[1. 41
[9, 16, 25]
Question 12
If squares = [1, 4, 9, 16, 25], what is the value of squares[0::2] ?
[1, 4]
an error
[1, 9, 25]
[1, 4, 9]
Question 13
What function can be used to determine the smallest value in a list?
smallest()
min()
least()
minimum()
Question 14
Which keyword is used to determine if a value is in a list?
contains
in
has
within
Question 15
Assuming alist is a list of 4 items, what does this statement do:
alist[11 = 2
Insert two items into the list at position 1
Change alist's second item to 2
4. Change alist's first item to 2
Insert an item in a list at position 1 with value 2
Question 16
Which statement can be used to insert an item into a list named alist?
alist.insert(item, O)
insert(alist, item)
alist.insert(O, item)
alist <- item
Question 17
What method can be used to append a list to the end of another list?
augment()
extend()
concatenate()
add()
Question 18
Assuming the list squares is set to [1, 4, 9, 16], what statement can be
used to remove the value 1 from the list
del alist.0
alist.remove(1)
remove(alist, 1)
remove(alist, O)
Ouestion 19
Assuming alist is a list with 4 items, what statement can be used to
remove the last item from alist and assignment the variable last to its
value?
last = alist.pop()
last = alist.drop()
last = alist[-1]
last = alist[0]
5. Question 20
What statement can be used to remove all items from a list named alist?
delete alist
alist.clear()
del alist
clear(alist)
Question 21
What statement can be used to remove the first item from a list named
alist?
remove(alist, 0)
alist.remove(O)
del alist[O]
del(alist, O)
Question 22
If alist is a list, what method can be used to create a new list with a copy
of the items contained in alist?
blist = alist.dup()
blist = alist
copy(alist, blist)
blist = alist.copy()
Question 23
If alist is a list, what does sorted(alist) do?
generates a new ordered list
checks if alist is sorted, and return True or False
returns the index of the first item out of order
updates alist so that its items are in order
Question 24
If alist is a list, what does alist.sort( do?
checks if alist is sorted =, and return True or False
generates a new ordered list
updates alist so that its items are in order
returns the index of the first item out of order
6. Question 25
If alist is a list, what does alist.reverse do?
generates a new list in reverse order
checks if alist is reverse sorted, and return True or False
updates alist so that its items are in reverse order
returns the index of the first item out of order
Question 26
A table can be represented as a list of lists.
True
False
Question 27
After a tuple is created, its items can be changed.
True
False
Question 28
Which can be used to create a tuple?
square brackets
curly braces
colons
parentheses
Question 29
A tuple's items can be access by square brackets, similar to lists.
True
False