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
Exam (elaborations)

2025/2026 CIT 332 FINAL EXAM QUESTIONS AND DETAILED CORRECT ANSWERS | A+ GRADE VERIFIED ANSWERS

Rating
-
Sold
-
Pages
31
Grade
A+
Uploaded on
27-08-2025
Written in
2025/2026

2025/2026 CIT 332 FINAL EXAM QUESTIONS AND DETAILED CORRECT ANSWERS | A+ GRADE VERIFIED ANSWERS

Institution
CIT 332
Course
CIT 332

Content preview

2025/2026 CIT 332 FINAL EXAM
QUESTIONS AND DETAILED CORRECT
ANSWERS | A+ GRADE VERIFIED
ANSWERS

The list [20, 30, 40, 10] is sorted by insertion sort with 3
calls to the insert method. How many of those calls need
to modify the location of at least one element in the list
and why? Correct Answer One call - only the last call to
insert modifies the location of an element since it starts
with [<20, 30, 40> ,10]

The list [40, 10, 20, 30] is sorted by insertion sort with
three calls to the insert method. How many of those calls
need to modify the location of at least one element in the
list and why? Correct Answer All calls to insert modify an
element's location - since all elements to be inserted are
smaller than 40.

To sort a list in descending order, what changes are
needed in the insert function? Correct Answer Change the
condition for the while to: i >= 0 and elements[i] < target.

Given a sorted list with 1,000,000,000 elements, how
many comparisons are needed to find an element in the
worst case? Correct Answer 30

What's the output of the following code?
def find(all, target):

,left = 0
right = len(all) - 1
while left <= right:
mid = (left + right) // 2
print(mid, all[mid])
if all[mid] == target:
return mid
elif all[mid] > target:
right = mid - 1
else:
left = mid + 1
return -1
def main():
all = [1, 2, 5, 8, 11, 15, 19]
print(find(all, 6))
main() Correct Answer 3 8
12
25
-1

What's the output of the following code?
def find(all, target):
left = 0
right = len(all) - 1
while left <= right:
mid = (left + right) // 2
print(mid, all[mid])
if all[mid] == target:
return mid
elif all[mid] > target:
right = mid - 1

,else:
left = mid + 1
return -1
def main():
all = [1, 2, 5, 8, 11, 15, 19]
print(find(all, 5))
main() Correct Answer 3 8
12
25
2

Given the following statement in a code
from random import *
which of the following is a correct statement to shuffle list
list1? Correct Answer shuffle(list1)

What is the output of the following code?
aList = [1, 2, 3, 4]
aList.reverse()
print(aList) Correct Answer [4, 3, 2, 1]

What is the output when the following code segment is
executed?
firstList = [10, 31, 85, 96]
secondList = firstList
secondList[1] = 400
print(secondList)
print(firstList == secondList) Correct Answer [10, 400, 85,
96] True

, Suppose list1 is [13, 18, 59, 21, 75, 44], what are the
elements of list1 after executing list1.pop()? Correct
Answer [13, 18, 59, 21, 75]

Suppose that list1 is [99,16, 85, 43], What is the result of
list1[:-1]? Correct Answer [99,16, 85]

Given a list1 with the following value:
list1 = [ [9, 7, 4], [0, 99, 8], [74, 33, 89]]
which of the following expression has the value of 99.
Correct Answer list1[1][1]

What's the output of the following code?
aList = [1, 3, 4, 2, 4, 2, 4]
m = aList[0]
index = 0
for i in range(len(aList)):
if aList[i] > m:
m = aList[i]
index = i
print(index) Correct Answer 2

What's the output of the following code?
list1 = ['XYZ', 'Zara', 'abc']
print(max(list1)) Correct Answer abc

What's the output of the following code?
sList = [1, 2, 3, 4, 5]
print(sList[-2])
print(sList[-4:-1]) Correct Answer 4
[2, 3, 4]

Written for

Institution
CIT 332
Course
CIT 332

Document information

Uploaded on
August 27, 2025
Number of pages
31
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$23.49
Get access to the full document:

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

Get to know the seller

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.
TUTORWAC Johns Hopkins University
Follow You need to be logged in order to follow users or courses
Sold
362
Member since
2 year
Number of followers
115
Documents
3595
Last sold
5 days ago
TUTORWAC

BEST HOMEWORK HELP AND TUTORING ON YOUR QUIZZES AND EXAMS WITH GUARANTEE OF EXCELLENT GRADES

4.1

55 reviews

5
32
4
9
3
7
2
3
1
4

Recently viewed by you

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