• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 18 pages
Exam (elaborations)

CIS 5450 - Midterm 1 Actual Exam Questions and 100% Accurate Answers | Data Science | Programming | Pass Guaranteed - A+ Graded

Document preview thumbnail
Preview 3 out of 18 pages

Master data science fundamentals with this CIS 5450 - Midterm 1 Actual Exam featuring questions and 100% accurate answers. This complete actual exam covers key topics including Python programming for data analysis, SQL queries and database management, data manipulation with pandas, data visualization principles, and machine learning foundations. Each question includes detailed rationales and elaborated solutions to ensure comprehensive understanding for data science success. Backed by our Pass Guarantee. Download now.

Content preview

CIS 5450 - Midterm 1 Actual Exam Questions and
100% Accurate Answers | Data Science |
Programming | Pass Guaranteed - A+ Graded

Python Programming Fundamentals & Data Structures

Q1: You are writing a script to calculate exact financial figures. If you run the operation
in Python 3, what is the resulting data type?
A. int
B. float [CORRECT]
C. decimal
D. double
Correct Answer: B
Rationale: The correct answer is float because in Python 3, the standard division
operator (/) always returns a floating-point number, even if the operands are integers,
ensuring we don't lose precision in fractional calculations.

Q2: A student is trying to extract the middle two elements from a list my_list = [10, 20,
30, 40, 50] using slicing. Which of the following expressions will correctly return [20,
30, 40]?
A. my_list[1:4] [CORRECT]
B. my_list[2:4]
C. my_list[1:3]
D. my_list[2:5]
Correct Answer: A
Rationale: The correct answer is my_list[1:4] because Python slicing is exclusive of
the stop index, meaning this slice grabs elements at index 1, 2, and 3, exactly capturing
the middle three requested elements without including the final 50.

Q3: You have an existing list data = [1, 2] and you want to add the elements of
another list more_data = [3, 4] so that data becomes [1, 2, 3, 4]. Which method
should you use?
A. data.append(more_data)
B. data.extend(more_data) [CORRECT]
C. data.insert(more_data)
D. data.add(more_data)
Correct Answer: B

,Rationale: The correct answer is data.extend(more_data) because the extend method
iterates through the provided iterable and appends each individual element to the list,
whereas append would add the entire list as a single nested sublist.

Q4: In CIS 5450, remember that lists are mutable but tuples are immutable, so use a
tuple when you need hashable keys for a dictionary. Given this, which of the following is
a valid dictionary key?
A. ['a', 'b']
B. (1, 2) [CORRECT]
C. {1, 2}
D. [1]
Correct Answer: B
Rationale: The correct answer is (1, 2) because tuples are immutable and therefore
hashable, making them perfectly safe to use as dictionary keys, unlike lists or sets
which are mutable and will throw a TypeError.

Q5: You are accessing a dictionary user_scores = {'alice': 85, 'bob': 92} and you
aren't sure if 'charlie' is in it. Which approach will return None instead of throwing a
KeyError if 'charlie' is missing?
A. user_scores['charlie']
B. user_scores.pop('charlie')
C. user_scores.get('charlie') [CORRECT]
D. user_scores.find('charlie')
Correct Answer: C
Rationale: The correct answer is user_scores.get('charlie') because the get method
is designed to safely return a default value (which defaults to None) if the key is not
found, preventing your program from crashing.

Q6: You need to remove all duplicate integers from a list [1, 2, 2, 3, 4, 4, 5] while
preserving the unique elements. What is the most Pythonic way to achieve this?
A. Convert the list to a set [CORRECT]
B. Iterate with a for loop and use list.remove()
C. Use a list comprehension with an if statement checking the index
D. Sort the list and use list.pop()
Correct Answer: A
Rationale: The correct answer is converting the list to a set because sets inherently only
store unique elements, making set([1, 2, 2, 3, 4, 4, 5]) the fastest and most
readable way to filter out duplicates.

Q7: Given two sets, A and B
= {1, 2, 3} = {3, 4, 5}, what does the operation
A.symmetric_difference(B) return?

, A. {3}
B. {1, 2, 4, 5} [CORRECT]
C. {1, 2, 3, 4, 5}
D. {1, 2}
Correct Answer: B
Rationale: The correct answer is {1, 2, 4, 5} because the symmetric difference
operator returns a new set containing elements that are in either of the sets, but not in
their intersection (effectively the opposite of an intersection).

Q8: You are working with a nested data structure: employees = [{'name': 'Alice',
'role': 'Engineer'}, {'name': 'Bob', 'role': 'Analyst'}]. How do you extract
Bob's role?
A. employees[1]['role'] [CORRECT]
B. employees['Bob']['role']
C. employees[2].role
D. employees.get(1).get('role')
Correct Answer: A
Rationale: The correct answer is employees[1]['role'] because 'Bob' is stored in the
dictionary at index 1 of the outer list, and standard bracket notation is used to chain the
lookup into the inner dictionary.

Q9: Consider the following control flow logic meant to classify a score:

python
score = 85
if score > 90:
grade = 'A'
elif score > 80:
grade = 'B'
elif score > 70:
grade = 'C'
What value will the grade variable hold?
A. 'A'
B. 'B' [CORRECT]
C. 'C'
D. None
Correct Answer: B
Rationale: The correct answer is 'B' because Python evaluates if/elif blocks
sequentially and stops at the first condition that evaluates to True, meaning an 85
triggers the score > 80 block and skips the rest.

Document information

Uploaded on
May 2, 2026
Number of pages
18
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.00

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.
PrimeScholars
3.3
(14)
Sold
102
Followers
0
Items
3570
Last sold
1 day 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