Data Science Exam 1 and II with
Complete Solutions
A is a two-dimensional array of integer numbers 50000x50000; B is a one-dimensional
array of 30000 floating-point numbers; C is a floating-point number. Which of the
following operations are valid? (Check all that applies.)
Answers:
A+C
C*A.T
B*C
A/B - ANSWER-B*C
A+C
C*A.T
A NumPy array a contains both numbers and nans. Hows does the function
numpy.sort(a) with the default parameters handle the nans?
Answers:
The nans are moved to the end of the array.
The nans are moved to the beginning of the array.
The nans are discarded from the array.
The function raises an exception. - ANSWER-The nans are moved to the end of the
array.
Alice noticed that the scatter plot of variable Y vs variable X that she plotted as a part of
the exploratory data analysis, looks almost like a straight diagonal line. What statement
is Alice entitled to make, based on this observation?
Answers:
A change in X causes a change in Y.
X and Y are correlated.
,A change in Y causes a change in X.
A change in X causes a change in Y and a change in Y causes a change in X. -
ANSWER-X and Y are correlated.
Alice obtained a list of all elevators in NYC for the purpose of checking which part of the
city has most high-capacity elevators. She imported the list as a Pandas Frame and
learned that it has the following columns: Capacity; Date of last inspection; Elevation;
Building ZIP code; Building latitude; Building longitude; Building street address. About
80% of values in the "Building street address" and "Bulding ZIP code" columns are
missing. What is Alice's best policy for handling the missing values?
Answers:
Eliminate all rows with missing values.
Eliminate all columns with missing values.
Infer the street address from the longitude and latitude.
Replace all missing street addresses with some default value (say, "11 Wall Street"). -
ANSWER-Infer the street address from the longitude and latitude.
Alice uses BeautifulSoup to process an HTML document. She expects that the tag
<div>, that defines a certain division of the document (<div>...</div>), has an attribute
class, and would like to extract the class name. The division tag is in the variable
fragment. Which expression correctly obtains the class name and stores it in the
variable c?
Answers:
c=fragment.get("class")
c=div["class"]
if fragment.has_attr("class"): c=fragment["class"]
Alice uses BeautifulSoup to process an HTML document. She expects that the tag <p>,
that defines a paragraph within the document (<p>...</p>), has an attribute class, and
would like to extract the class name. The paragraph tag is in the variable fragment.
Which expression correctly obtains the class name and stores it in the variable c?
Answers:
, c=fragment["class"]
fragment.find(p="class")
if fragment.has_attr("class"): c=fragment["class"]
Alice works for United Airlines (UA). She was asked to predict the overbooking of a
flight (True or False), based on the probability of a UA crew member needing to fly to
the same destination for another flight (one continuous variable in the range 0 through
1). Which models shall Alice use to make the prediction? (Check all that applies.)
An aircraft circles around an airport, waiting for a permission to land, staying at a
constant distance of 10 miles from the landing strip. What is the relationship between
the coordinates X and Y (or latitude and longitude) of the aircraft?
Answers:
They are correlated, but the correlation is not linear.
They are not correlated at all.
They are linearly correlated.
Not possible to tell. - ANSWER-They are correlated, but the correlation is not linear.
Array texmex contains the numbers of people crossing the border between Texas and
Mexico in both directions, by day. The number is positive if more people enter Texas
and negative if more people enter Mexico. Assuming that on day 0 the population of
Mexico was 0 and there is no way to enter Mexico other than from Texas, which
expression calculates the array that contains the total population of Mexico, by day?
Answers:
texmex.sum()
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller CLOUND. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.99. You're not tied to anything after your purchase.