Sample Test Questions for Chapter 16
1) What type of professional typically develops websites?
a. Computer scientist
b. Statistician
c. Data scientist
d. All three professions commonly develop websites
2) What are the three V's of big data?
a. Velocity, variety, verification
b. Verification, volume, vehemence
c. Volume, velocity, variety
d. Vision, versatility, vehemence
3) Over time, the volume of global data has ______.
a. decreased
b. stayed about the same
c. increased somewhat
d. increased exponentially
4) Which of the following is an advantage of using coding for data science projects instead of software?
a. The most common programming languages used in data science are free.
b. Updating and re-running analyses is generally faster using a programming language.
c. Code from programming languages is easier for data scientists to share with other people in the field.
d. All of the above
5) What is the correct order for the five-step process in the data science life cycle?
a. Gathering data, Cleaning data, Exploring data, Modeling data, Interpreting data
b. Exploring data, Modeling data, Gathering data, Cleaning data, Interpreting data
c. Gathering data, Modeling data, Cleaning data, Interpreting data, Exploring data
d. Cleaning data, Gathering data, Interpreting data, Exploring data, Modeling data
6) In data science, which describes the process of exploring data?
a. Create data visualizations and calculate summary statistics to explore potential relationships in the
dataset.
b. Describe and interpret conclusions from data through written reports and presentations.
c. Identify available and relevant data; gather new data if needed.
d. Use modeling skills and content knowledge to fit and evaluate models, measure relationships, and
make predictions.
7) Which of the following would be considered unstructured data?
a. A sample of 500 product reviews where each review is a rating on a scale of 1 to 5.
b. A sample of revenues made over a month from 500 different products.
c. A sample of 50 emails sent from the customer service center of a retailer.
d. A sample of 50 prices being charged for the same product on different websites.
8) Which of the following scenarios is appropriate for a regression model?
a. Predicting what phone plan a customer will purchase.
b. Predicting whether a patient with heart disease will survive.
c. Predicting which type of heating unit will be best for an office building.
d. Predicting the gas mileage of a vehicle.
9) Which code loads the package seaborn with the alias sns?
a. from seaborn import scatterplot
b. import seaborn as sns
c. import sns as seaborn
d. library(seaborn)
10) Which code loads the function read_csv from the package pandas?
a. from pandas import read_csv
b. from read_csv import pandas
c. import pandas as read_csv
d. import pandas.read_csv
11) Which best describes the package pandas?
a. Allows the creation of data visualizations
b. Includes functions and classes that aid in numerical computation
c. Provides algorithms and functions for computing problems that arise in science, engineering and
statistics
d. Provides methods and classes for tabular and time-series data
12) Which package allows the creation of data visualizations and works well with pandas?
a. numpy
b. seaborn
c. scipy
d. sklearn
13) A/An _____ installs, updates, and removes packages.
a. dependency
b. installer
c. package manager
d. terminal
14) Jupyter is convenient for testing, presenting, and sharing code, because ______ contain code,
output, and text all in one place.
a. documents
b. notebooks
c. scripts
d. web pages
15) Which package provides tools for scientific and mathematical computations in Python?
a. pandas
b. numpy
c. sklearn
d. matplotlib
16) Select the line of code which is a 2-D array.
a. [Link]([1, 2, 3, 4, 5])
b. [Link]([1, 2, 3, 4, 5],[6, 7, 8, 9, 10])
c. [Link]((1, 2, 3, 4, 5),(6, 7, 8, 9, 10))
d. [Link]([(1, 2, 3, 4, 5),(6, 7, 8, 9, 10)])
17) What [Link]((3, 2))create?
a. [[1. 1. 1.]
[1. 1. 1.]]
b. [(1. 1.)
(1. 1.)
(1. 1.)]
c. [[1. 1.]
[1. 1.]
[1. 1.]]
d. [(1. 1. 1.)
(1. 1. 1.)]
18) Which numpy function creates the sequence [0.4,0.5,0.6,0.7]?
a. [Link](0.4,0.7,4)
b. [Link](0.4,0.7,4)
c. [Link](0.4,0.7,4)
d. [Link](0.4,0.7,4)
19) Identify the code used for matrix multiplication of two arrays.
a. [Link](array1, array2)
b. [Link](array1, array2)
c. [Link](array1, array2)
d. [Link](array1, array2)
20) Which of the following is true of apandasDataFrame, but not of anumpyarray?
a. Dataframes are indexed, ordered, and mutable containers.
b. Dataframes have a shape.
c. Dataframes may have any number of dimensions.
d. Different dataframe columns may have different types.
21) Which code would create the following dataframe?
a. import pandas as pd
[Link](data = [["Riley", 19, "Dubuque", "IA"],
["Lex", 25, "Riverside", "CA"],
["Mel", 20, "Hoboken", "NJ"],
["Lynn", 22, "Austin", "TX"]],
columns = ["Name", "Age", "City", "State"],
index = None
)
b. import pandas as pd
[Link](data = [["Riley", 19, "Dubuque", "IA"],
["Lex", 25, "Riverside", "CA"],
["Mel", 20, "Hoboken", "NJ"],
["Lynn", 22, "Austin", "TX"]],
labels = ["Name", "Age", "City", "State"],
index = 0:3
)
c. import pandas as pd
[Link](info = [["Riley", 19, "Dubuque", "IA"],
["Lex", 25, "Riverside", "CA"],
["Mel", 20, "Hoboken", "NJ"],
["Lynn", 22, "Austin", "TX"]],
columns = ["Name", "Age", "City", "State"],
index = 0:3
)
d. import pandas as pd
[Link](info = [["Riley", 19, "Dubuque", "IA"],
["Lex", 25, "Riverside", "CA"],
["Mel", 20, "Hoboken", "NJ"],
["Lynn", 22, "Austin", "TX"]],
labels = ["Name", "Age", "City", "State"],
index = None
)
22) The DataFrame dat is defined as:
Name Age City State
0 Riley 19 Dubuque IA
1 Lex 25 Riverside CA
2 Mel 20 Hoboken NJ
3 Lynn 22 Austin TX
Which will return the following?
Name Age
1 Lex 25
2 Mel 20
a. [Link][1:2,0:1]
b. [Link][1:3,0:2]
c. [Link][1:2, 0:1]
d. [Link][2:3, ["Name","Age"]]
23) The DataFrame dat is defined as:
Name Age City State
0 Riley 19 Dubuque IA
1 Lex 25 Riverside CA
2 Mel 20 Hoboken NJ
3 Lynn 22 Austin TX
Which will return the following?
Name Age City State
0 Riley 19 Dubuque IA
2 Mel 20 Hoboken NJ
a. dat["Age"]<21
b. dat[dat["Age"]<21]
c. dat[dat["Age"]>21]
d. dat[[Link][1]<21]
24) The DataFrame dat is defined as:
Name Age City State
0 Riley 19 Dubuque IA
1 Lex 25 Riverside CA
2 Mel 20 Hoboken NJ
3 Lynn 22 Austin TX
Which will return the following?
Nam State
e
0 Riley IA
2 Mel NJ
3 Lynn TX
a. dat[dat["Age"]<=22,["Name","State"]]
b. dat[dat["Age"]<=22]
c. dat[dat["Age"]<=22]["Name","State"]
d. dat[dat["Age"]<=22][["Name","State"]]
25) Which XXX would generate the following plot?
import [Link] as plt
xx = [1,2,3,4]
yy = [5,1,4,2]
XXX
[Link](x = xx, y = yy)
a. [Link](figsize=[2,4])
b. [Link](figsize=[4,2])
c. [Link](figsize=[4,4])
d. [Link](figsize=2)
26) Which XXX would generate the following plot?
import [Link] as plt
xx = [1,2,3,4]
yy = [5,1,4,2]
[Link](x = xx, y = yy)
XXX
a. [Link]("Horizontal feature")
[Link]("Vertical feature")
[Link]("Title")
b. [Link](Horizontal feature)
[Link](Vertical feature)
[Link](Title)
c. [Link]("Horizontal feature")
[Link]("Vertical feature")
d. [Link]("Horizontal feature")
[Link]("Vertical feature")
[Link]("Title")
27) Which XXX would generate the following plot?
import [Link] as plt
xx = [1,2,3,4]
yy = [5,1,4,2]
XXX
a. [Link](xx, yy, "r-")
b. [Link](xx, yy, "r.")
c. [Link](xx, yy, "r--")
d. [Link](xx, yy, "d")
28) Which XXX would generate the following plot?
import [Link] as plt
xx = [Link](-5, 5, num=100)
XXX 1)
[Link](xx, 4*xx-3)
[Link]("Linear")
XXX 2)
[Link](xx, xx*xx-16, "g")
[Link]("Quadratic")
a. [Link](1,2,
b. subplot(
c. [Link](2,1,
d. [Link](2,
29) Which XXX would generate the following plot?
import [Link] as plt
XXX
a. [Link](color="b", linestyle="--")
b. grid(color="b", linestyle="--")
c. [Link]( linestyle="--")
d. [Link](color="b")