






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























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 CA.T BC A/B - ANSWER-BC A+C CA.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 , that defines a certain division of the document (...), 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"] fragment.find(div="class") - ANSWER-if fragment.has_attr("class"): c=fragment["class"] Alice uses BeautifulSoup to process an HTML document. She expects that the tag
, that defines a paragraph within the document (
...
), 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:texmex.mean() -texmex.cumsum() texmex.cumsum() - ANSWER--texmex.cumsum() At least what level of data analysis is needed to make the following statement: "Based on the observation of 20 students taking CMPSC-310, we conclude that 20% of the world population are female." Answers: Descriptive. Inferential. Predictive. Exploratory. - ANSWER-Inferential. Bob applied Pandas function get_dummies() to a series of 75 integer numbers between 0 and 10, inclusive. Which fact is true about the resulting data frame? Answers: Each column has at most 10 ones. All row sums are in the range between 0 and 10, inclusive. All row sums are equal to 1. All column sums are equal to 75. - ANSWER-All row sums are equal to 1. Bob attempts to download a data file using the follolwing statement: data = urllib.request.urlopen ("http://foo.bar/foobar.tgz") However, the URL http://foo.bar/foobar.tgz is no longer valid. What will be the value of the variable data after the execution of the statement? Answers: The statement raises an exception. The variable data does not exist. The value of data is None. The value of data is unknown.
The value of data is an empty string. - ANSWER-The statement raises an exception. The variable data does not exist. Bob submitted a project report that states that the collected data set has 15, observations of two variables, foo and bar. Of them, 678 observations are incomplete and have missing data. The mean values of foo and bar are 3.76 and -6.12, respectively. All observed values of foo are positive and all observed values of bar are negative. What kind of data analysis did Bob perform? Answers: Predictive Exploratory Inferential Descriptive - ANSWER-Descriptive Bob uses BeautifulSoup to process a well-formed HTML document. The soup is stored in the variable doc. Which Python expression calculates the first top-level header of the document, represented as a human-readable string? Note: Incidentally, this question has two correct answers. Select any correct answer to get full credit. Answers: doc.body.h1() doc.body.h doc.find_all("h1") doc.h1 - ANSWER-doc.body.h Chuck created a Pandas series paychecks. The series index has three duplicate entries
The path does not exist. 4 2 5 - ANSWER- Consider the network of FIFA Soccer World Cup participants. What are the unweighted in- and out-degrees of Uruguay? Answers: 6, 7 6, 8 5, 8 6, 5 - ANSWER-5, Function numpy.unique(A) returns all distinct (unique) values in the array A. What is the value of the following expression? (Do not execute this code: Your Python will run out of memory.) numpy.unique(numpy.eye(500000) - 2) Answers: 500000 250000000000 array([0,2]) array([-2,-1]) - ANSWER-array([-2,-1]) grade is a Pandas DataFrame. Which string in the following expression is the column name? grade.ix["Bob"]["CS310"] Answers: "grade" Not enough data to tell. "CS310"
"Bob" - ANSWER-"CS310" How is the header row (the row that contains column headers) designated in a CSV file? Answers: All words in the header row are spelled in all capital letters. The header row begins with a '#'. CSV does not any special designation for the header row. The first row of a CSV file is the header row. - ANSWER-CSV does not any special designation for the header row. How many characters does the following string have? r"\\n" Answers: Answers: 5 4 3 2 - ANSWER- How many English names listed in the names corpus are also common English words listed in the words corpus? Hint: Treat the corpora as sets of words. Answers: ~ ~ ~ ~1800 - ANSWER-~ How many maximal cliques of the size of 2 or more are in the following network? Answers: 3 7
infile.read(512) infile.readlines() - ANSWER-infile.readline() infile.read(512) Is it a good idea to use interactive GUI tools for reproducible data analysis (as opposed to command-line programmed tools), and why? Answers: No, it is not. Interactive GUI tools do not record the history of operations, which makes the analysis not reproducible. No, it is not. Interactive GUI tools are usually oversimplified, stripped down versions of powerful programmable data processing environments. Yes, it is. Interactive GUI tools simplify data analysis and make it more accessible. Yes, it is. Interactive GUI tools, as a rule, provide more powerful data analysis techniques. - ANSWER-No, it is not. Interactive GUI tools do not record the history of operations, which makes the analysis not reproducible. Let corpus be a custom-made word corpus. What does the method corpus.raw() return? Answers: A string consisting of all the words in the corpus separated by white spaces. A non-human-readable (binary) representation of all the words in the corpus. A list of all the words in the corpus. A string consisting of all the words in the corpus separated by line breaks. - ANSWER-A string consisting of all the words in the corpus separated by line breaks. Let price be a data series, possibly with some missing values. Alice decided to replace the missing values with the average of all non-missing values. Which operator should Alice use instead of X in the following statement? price[price.isnull()] = price[X price.isnull()].mean() Answers: ! ~
not - ANSWER-- Let s be a string. What does the following statement do? " ".join(s.split()) Answers: Correct Removes duplicate spaces from s. Inserts spaces between every two consecutive characters of s. Nothing. (The result is the same as s.) Removes all spaces from s. - ANSWER-Removes duplicate spaces from s. Let x=[0, .1, .2, ...., .9, 1.0] and y=[0,0,0,0,0,1,1,1,1,1,1]. Fit the ordinary least square linear model (OLS), the Ridge model (RIDGE) with alpha=0.5, and the logistic regression model (LR) into these data and calculate the fitting score for each of the models. What is the relationships between the models' scores? Answers: score(LR) < score(OLS) < score(RIDGE) score(LR) < score(RIDGE) < score(OLS) score(OLS) < score(RIDGE) < score(LR) score(RIDGE) < score(OLS) < score(LR) - ANSWER-score(RIDGE) < score(OLS) < score(LR) numpy.inf is a special symbol representing a mathematical infinity. Which arithmetic operations on two numpy.inf operands do not produce a numpy.inf? Answers: Subtraction and division. All four operations produce a numpy.inf. Multiplication and division. Addition and subtraction. - ANSWER-Subtraction and division.
The correlation of the variables X and Y is 0.75, and the p-value of the correlation is .00001. When X increases, what happens to Y? Answers: Y is not likely to change in any predictable direction. Y most likely increases. Y does not change. Y definitely decreases. - ANSWER-Y most likely increases. The data frame edges describes the edges of a directional network. The data frame has three columns: start (the label of the start node), end (the label of the end node), and weight (the weight of the edge). Which expression calculates the outdegree of each node? Answers: edges.groupby(['start']).count() edges.groupby(['end']).count() edges.groupby(['end']).sum() edges.groupby(['weight']).sum() - ANSWER-edges.groupby(['start']).count() The data on the US population by age (0-99 years), gender (M/F), and census year (1900-2014) are used as input for the k-means clustering algorithm. Which statement is true about the clustering result? Answers: The number of clusters will be determined automatically, based on the data size. The age of 999 is impossible. The clustering algorithm will fail. All clusters will have the same number of data points. Sex will be mostly ignored by the algorithm. - ANSWER-Sex will be mostly ignored by the algorithm. The following HTML fragment has been converted into a BeautifulSoup and stored in the variable soup: Take me to the moon!
Match the Python expressions related to the soup and their values. All Answer Choices A. "http://moon.ss" B. " Take me to the moon! " C. "Take me to the moon!" D. "a" - ANSWER-D. "a" B. " Take me to the moon! " A. "http://moon.ss" C. "Take me to the moon!" The Frame towns has the following columns: "STATE", "NAME", and "POP" (population). Which expression calculates the population of the smallest town in each state? Answers: towns.sort("POP", ascending = True).groupby(["STATE"]).min() towns.groupby(["STATE"]).min() towns.sort("POP", ascending = True).groupby(["STATE"]).first() towns.sort("POP", ascending = False).groupby(["STATE"]).min() - ANSWER- towns.sort("POP", ascending = True).groupby(["STATE"]).first() What data source can be used to "cook" a BeautifulSoup object? (Check all that apply.) Answers: A Python dictionary. A list of numbers. An open file. An open URL. - ANSWER-An open file.
The regression coefficients corresponding to the collinear predictors increase. The intersect decreases. The intersect decreases. The regression coefficients corresponding to the collinear predictors decrease. - ANSWER-The regression coefficients corresponding to the collinear predictors decrease. What is data alignment with respect to Pandas Frames and Series? Answers: Selection of values with matching indeces (rather than in matching positions) for binary arithmetic operations. Replacement of the results of some binary operations with missing values (NAs). Elimination of missing values (NAs). Transformation of all values in a Frame/Series to the range [0...1]. - ANSWER-Selection of values with matching indeces (rather than in matching positions) for binary arithmetic operations. What is data serialization? Answers: The process of assigning a serial number to an object. The process of converting an object into a stream of bytes in order to store the object to a file. The process of reading a stream of bytes from a file in order to convert them into an object. The process of storing a stream of bytes to a file. - ANSWER-The process of converting an object into a stream of bytes in order to store the object to a file. What is model overfitting? Answers: A situation when the model "memorizes" each item used for its training.
A situation when the model has too many features. A situation when k-mean clustering algorithm produces too many clusters. A situation when the Ordinary Least Square regression is fitted with very high R2. - ANSWER-A situation when the model "memorizes" each item used for its training. What is sentiment analysis? Answers: Classifying a text as being positive or negative, based on the frequencies of positive- charged and negative-charged words and expressions. Splitting a text into words and identifying which of them are nouns. Locating and classifying elements in a text into pre-defined categories such as the names of persons, organizations, etc. - ANSWER-Classifying a text as being positive or negative, based on the frequencies of positive-charged and negative-charged words and expressions. What is the best external storage format for each of the following Python objects? Rich text with emphasized words, sections, paragraphs, etc., intended for human users. A two-dimensional list of unordered floating point numbers, intended for human users. A set of dictionaries, intended for another Python program. All Answer Choices A. HTML B. Pickle C. CSV - ANSWER-A. HTML C. CSV B. Pickle What is the difference between the Porter and Lancaster stemmers? Answers:
What is the second most frequent part of speech, as reported by the NLTK POS tagger, among the first 10,000 common English words from the words corpus? Hint: Use a Counter! Answers: Proper noun. Adverb. Common noun. Adjective. - ANSWER-Adjective What is the value of the following expression? (Do not execute this code: Your Python will run out of memory.) numpy.unique(numpy.eye(50000) - 2) Answers: array([0,2]) 50000 array([-2,-1]) 2500000000 - ANSWER-array([-2,-1]) What is the value of the following expression? (Do not run this program: Python will run out of memory!) numpy.eye(50000).trace() Answers: 50000 2500000000 1 0 - ANSWER-
What is the way to read a CSV file without the header row using the standard CSV reader? Answers: Read the first line from the file using readline() and then construct a CSV reader that reads from the file. Pass the option nrows=1 to the reader. Pass the option header=False to the reader. Read the whole file as a list of strings, remove the first string, and construct a CSV reader that reads from the list of the remaining strings. - ANSWER-Read the first line from the file using readline() and then construct a CSV reader that reads from the file. What is used by NumPy to represent a missing value? Answers: An empty string. numpy.na numpy.nan None - ANSWER-numpy.nan What operations must be avoided in the course of reproducible data processing? (Check all that apply.) Answers: Use of commercial software. Operations requiring manual steps. Operations involving GUI (interactive) tools. Operations requiring Internet access. - ANSWER-Operations requiring manual steps. Operations involving GUI (interactive) tools. What symbols can be used as delimiters in a CSV file? Answers: Any ASCII symbol, as long as it is not used in any dataitem stored in the file.