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 3 out of 18 pages
Exam (elaborations)

Palomar College CSCI 290/CSCI290 - Midterm Exam | Answered Correctly_ 100% updated 2025/26.

Document preview thumbnail
Preview 3 out of 18 pages

Palomar College CSCI 290/CSCI290 - Midterm Exam | Answered Correctly_ 100% updated 2025/26.

Content preview

CSCI290 – Midterm
Grades:
Q1- Q6: 1 point for each question.
Q7 - Q13: 2 points for each question.

Note: All your answers, including codes and their results (screen capture image), shall be
written in this document. Rename this document to lastname_midterm.doc (e.g.
abla_midterm.doc) and submit. This is the only document you need to submit.


Student name:
Q1: I have following two python lists:
List1 = [1, 2, 3, 4, 5]
List2 = [10, 20, 30, 40, 50]
I’ve created List3 by dividing each element of List2 by 2.
I’ve converted List1 and List3 to numpy arrays: a,b.
Then, I did the following:
c= a*b
d =numpy.sum(c)
Converted d from floating point data type into integer.

what will be the value of d?
a. 550
b. 275
c. 1050
d. 525

Answer: b. 275


Q2: What is the output of the following code:
def mystery(value1, value2, value3):
m_value = value1
if value2 > m_value:
m_value = value2
if value3 > m_value:
m_value = value3
return m_value


print(mystery(123, 245, 36))
print(mystery(23.3, 45.6, 99.7))
print(mystery('yellow', 'red', 'blue' ))

,Answer:
245
99.7
yellow

Q3: Which of the following statements about numpy is false?
a. Arrays in this library perform computations more efficiently than standard Python lists.
b. Arrays from this library allow elements of various types within the same container.
c.The library includes built-in support for linear algebra, signal processing, and random number
generation.
d. Arrays within this library have fixed dimensions and require explicit modifications to alter
their shape.

Answer: b. Arrays from this library allow elements of various types within the
same container.

Q4. Which of the following statements about Pandas is incorrect?

a. Pandas DataFrames allow columns to have different data types
b. Pandas Series are always two-dimensional, like DataFrames.
c. Pandas provides built-in functions for handling missing data.
d. Pandas supports reading and writing data from multiple file formats, including CSV,
Excel, and SQL databases.

Answer: b. Pandas Series are always two-dimensional, like DataFrames.

Q5: Given the following class definitions and instances:
 There is a base class Animal with an __init__ method that takes a name parameter and
initializes a self.name attribute.
 The Animal class also has a speak method that prints "The animal speaks".
 There is a derived class Dog that inherits from Animal.
 The Dog class overrides the speak method to print "The dog barks".
 There is another derived class Puppy that inherits from Dog, but it does not define any
new methods.
 An instance dog of the Dog class is created with the name "Buddy".
 An instance puppy of the Puppy class is created with the name "Rufus".

The speak method is called on both dog and puppy (as following):
dog.speak()
puppy.speak()

What is the output?

A.
The dog barks
The animal speaks

, B.
The animal speaks
The animal speaks

C.
The dog barks
The dog barks

D.
The animal speaks
The dog barks

Answer: C.
The dog barks
The dog barks

Q6: Given the following Pandas data frame

Name Age Score
0 Alice 25 75
1 Bob 32 88
2 Carol 27 92
3 Dave 29 81
4 Emily 31 67

What is the correct way to sort the DataFrame df in descending order based on the Age column?

A. df.sort_values(by='Age', ascending=False, inplace=True)

B. df.sort_values('Age', ascending=True, inplace=True)

C. df = df.sort_values('Age', ascending=False)

D. df.sort_values(['Score'], ascending=[False], inplace=True)

Answer: A. df.sort_values(by='Age', ascending=False, inplace=True)


Q7: Please write a code to count the total words and total characters, not including dash (“-“) and
space between the words, in the following variable blue_dot. Please show your code and results.

blue_dot = """ "We succeeded in taking that picture [from deep space],
and, if you look at it, you see a dot. That's here. That's home.
That's us. On it, everyone you ever heard of, every human being who
ever lived, lived out their lives. The aggregate of all our joys and
sufferings, thousands of confident religions, ideologies and economic

Document information

Uploaded on
November 8, 2025
Number of pages
18
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$19.99

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.
MindCraft
3.8
(49)
Sold
381
Followers
9
Items
2818
Last sold
8 hours 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