Choice and Conceptual Actual Exam Questions
With Reviewed 100% Correct Detailed Answers
Guaranteed Pass!!Current Update
1. T or F: The code below makes third have a value of 83.0
scores = [75.0, 68.5, 83.0]
third = scores[2] - ANSWER True
2. T or F: Negative indices count from the right end. - ANSWER True
3. What is the value of third after running the code below?
scores = [75.0, 68.5, 83.0]
third = scores[-1] - ANSWER 83.0
4. Which is an example of negative indices? - ANSWER scores = [75.0,
68.5, 83.0]
third = scores[-1]
5. Which is an example of positive indices? - ANSWER scores = [75.0, 68.5,
83.0]
third = scores[2]
,6. Slicing gives a... - ANSWER List of elements
7. Subscripting gives a... - ANSWER Single element
8. Which is an example of slicing a list? - ANSWER scores = [68.5, 83.0]
9. exams = scores[1:3]
10.T or F: Each list is an object. - ANSWER True
11.Which is an example of how you call a list method? - ANSWER
list.methodName(arguments)
12.T or F: The in operator does not check for that exact method, and looks
"inside" elements. - ANSWER False
13.To search for an element in a list, you can use the... - ANSWER in
operator and index method
14.Which is an example of using the in operator to search for an element in a
list? - ANSWER Names = ["William", "Scott", "Sophia"]
if "William" in Names:
,15.Which is an example of using the index method to search for an element's
position in a list? - ANSWER Names = ["William", "Scott", "Sophia"]
loc = Names.index("Scott")
# loc is 1
16.Which is an example of using the index method to search for an element
from the start to the end of a list? - ANSWER List.index(elem, start,
end)
17.T or F: If the index method finds the element, it return its index (position)
inside the list. - ANSWER True
18.T or F: A ValueError is given when the index method searches for the
element and the element is not between start and end in the list. -
ANSWER True
19.T or F: A Searchgive Error is not given when the index method is used and
the element is NOT found. - ANSWER False
20.Which is an example of transversing a list with a for loop? - ANSWER
scores = [ 85, 72, 56, 98, 84, 72]
for grade in scores:
print(grade)
, 21.To get both indices and elements in transversing a list, use... - ANSWER
A loop controlled with range(len(list)) with subscripting
for index in range(len(scores)):
print (index,"\t"
,grade[i])
Enumerate(mylist) to control the
for loop
for index, grade in enumerate(scores):
print (index,"\t"
,grade)
22.Which is an example of using the extend method to add a whole list to the
end of a list? - ANSWER scores = [ 85, 72, 56, 98, 84, 72]
scores.extend([55, 88, 79])
23.What will be the result of the code below?
Names = ["William", "Scott", "Sophia"]
Names.insert (2, "Hanah") - ANSWER Names = ["William", "Scott",
"Hannah", "Sophia"]