Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 13 pages
Exam (elaborations)

CNIT 155 CORE EXAMS SET 2025/2026 QUESTIONS WITH ANSWERS RATED A+

Document preview thumbnail
Preview 2 out of 13 pages

CNIT 155 CORE EXAMS SET 2025/2026 QUESTIONS WITH ANSWERS RATED A+

Content preview

CNIT 155 CORE EXAMS SET 2025/2026 QUESTIONS WITH
ANSWERS RATED A+
✔✔To get both indices and elements in transversing a list, use... - ✔✔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)

✔✔Which is an example of using the extend method to add a whole list to the end of a
list? - ✔✔scores = [ 85, 72, 56, 98, 84, 72]
scores.extend([55, 88, 79])

✔✔What will be the result of the code below?
Names = ["William", "Scott", "Sophia"]
Names.insert (2, "Hanah") - ✔✔Names = ["William", "Scott", "Hannah", "Sophia"]

✔✔T or F: Append, extend, and insert return something. - ✔✔False

✔✔What will be the result of this code?
colors = colors.append("yellow") - ✔✔ERROR
colors = None

✔✔What will be the result of this code?
colors.append("yellow") - ✔✔Changes colors to have "yellow" at end

✔✔What will be the result of this code?
colors + primaries - ✔✔ERROR
Longer list will be thrown out

✔✔What will be the result of this code?
colors = colors + primaries - ✔✔Returns a new list

✔✔T or F: You can delete from a list by index. - ✔✔True

✔✔Which is an example of deleting from a list using index? - ✔✔del list[index]

, ✔✔Deleting from a list using index... - ✔✔Removes the element at position index and
shifts down the following elements to fill in the gap

✔✔Which is an example of deleting a range from a list by using a slice? - ✔✔del list[2 :
5]
# removes elements at positions 2, 3, and 4

✔✔What does colors.remove("blue") do? - ✔✔Searches for the first occurrence of "blue
and deleters it

✔✔What does the "search and destroy" method do? - ✔✔Searches for and removes a
specific value from a list

✔✔What happens if the specific value can not be found using the "search and destroy"
method? - ✔✔Gives a runtime error

✔✔Which is an example fo the "search and destroy" method using del? - ✔✔if "blue" in
colors:
pos =
colors.index("blue")
del colors[pos]

✔✔What does the reverse method do to a list? - ✔✔Reverses the order of a list

✔✔Which is an example of using the reverse method on a list? - ✔✔mylist = ["red",
"green", "blue"]

mylist.reverse()

print(mylist) gives ["blue", "green", "red"]

✔✔T or F: After using the reverse method on a list, the original order is lost. - ✔✔True

✔✔T or F: The reverse method does not return a value. - ✔✔True

✔✔What will be the result of this code?
mylist = mylist.reverse() - ✔✔ERROR
mylist becomes None

✔✔Which is an example of a new reversed copy of the list? (original list remains
unchanged) - ✔✔backwards = list(reversed(mylist))

✔✔Reverse is a.... - ✔✔Method that mutates the list that is its argument

Document information

Uploaded on
June 18, 2025
Number of pages
13
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BOARDWALK
3.5
(40)
Sold
276
Followers
8
Items
32861
Last sold
6 days ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions