Data Visualization with Python Quiz Answers – Cognitive Class

Get Data Visualization with Python Quiz Answers

“A picture is worth a thousand words”. We are all familiar with this expression. It especially applies when trying to explain the insight obtained from the analysis of increasingly large data sets. Data visualization plays an essential role in the representation of both small and large scale data.

One of the key skills of a data scientist is the ability to tell a compelling story, visualizing data and findings in an approachable and stimulating way. Learning how to leverage a software tool to visualize data will also enable you to extract information, better understand the data, and make more effective decisions.

The main goal of this course is to teach you how to take data that at first glance has little meaning and present that data in a form that makes sense to people. Various techniques have been developed for presenting data visually but in this course, we will be using several data visualization libraries in Python, namely Matplotlib, seaborn, and Folium.

Enroll on Cognitive Class

Introduction To Visualization Tools

Question: What are the layers that make up the Matplotlib architecture?

  • FigureCanvas Layer, Renderer Layer, and Artist Layer.
  • Backend_Bases Layer, Artist Layer, Scripting Layer.
  • Backend Layer, Artist Layer, and Scripting Layer.
  • Backend Layer, FigureCanvas Layer, Renderer Layer, Artist Layer, and Scripting Layer.
  • Figure Layer, Artist Layer, and Scripting Layer.

Question: Using the inline backend, you can modify a figure after it is rendered.

  • False
  • True

Question: Which of the following are examples of Matplotlib magic functions? Choose all that apply.

  • %matplotlib inline
  • #matplotlib notebook
  • $matplotlib outline
  • %matplotlib notebook
  • #matplotlib inline

Basic Visualization Tools

Question: Area plots are stacked by default.

  • False
  • True

Question: Given a pandas series, series_data, which of the following will create a histogram of series_data and align the bin edges with the horizontal tick marks?

  1. count, bin_edges = np.histogram(series_data)
  2. series_data.plot(kind=’hist’, xticks = count, bin_edges)
  1. count, bin_edges = np.histogram(series_data)
  2. series_data.plot(kind=’hist’, xticks = count)
  1. count, bin_edges = np.histogram(series_data)
  2. series_data.plot(kind=’hist’, xticks = bin_edges)
  • series_data.plot(kind=’hist’)
  1. count, bin_edges = np.histogram(series_data)
  2. series_data.plot(type=’hist’, xticks = bin_edges)

Question: Given a pandas dataframe, question, which of the following will create a horizontal barchart of the data in question?

  • question.plot(type=’bar’, rot=90)
  • question.plot(kind=’bar’, orientation=’horizontal’)
  • question.plot(kind=’barh’)
  • question.plot(kind=’bar’)
  • question.plot(kind=’bar’, type=’horizontal’)

Specialized Visualization Tools

Question: Pie charts are less confusing than bar charts and should be your first attempt when creating a visual.

  • False
  • True
Box Plot

Question: What do the letters in the box plot above represent?

  • A = Mean, B = Upper Mean Quartile, C = Lower Mean Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Mean, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Median, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Median, B = Third Quartile, C = Mean, D = Inter Quartile Range, E = Lower Quartile, and F = Outliers
  • A = Mean, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Maximum

Question: What is the correct combination of function and parameter to create a box plot in Matplotlib?

  • Function = box, and Parameter = type, with value = “plot”
  • Function = boxplot, and Parameter = type, with value = “plot”
  • Function = plot, and Parameter = type, with value = “box”
  • Function = plot, and Parameter = kind, with value = “boxplot”
  • Function = plot, and Parameter = kind, with value = “box”

Advanced Visualization Tools

Question: Which of the choices below will create the following regression line plot, given a pandas dataframe, data_dataframe?

regression line plot
  1. import seaborn as sns
  2. ax = sns.regplot(x=”year”, y=”total”, data=data_dataframe, color=”green”)
  • data_dataframe.plot(kind=”regression”, color=”green”, marker=”+”)
  1. import seaborn as sns
  2. ax = sns.regplot(x=”year”, y=”total”, data=data_dataframe, color=”green”, marker=”+”)
  • data_dataframe.plot(kind=”regplot”, color=”green”, marker=”+”)
  1. import seaborn as sns
  2. ax = sns.regplot(x=”total”, y=”year”, data=data_dataframe, color=”green”)

Question: In Python, creating a waffle chart is straightforward since we can easily create one using the scripting layer of Matplotlib.

  • False
  • True

Question: A word cloud (choose all that apply)

  • is a depiction of the frequency of different words in some textual data.
  • is a depiction of the frequency of the stopwords, such as a, the, and, in some textual data.
  • is a depiction of the meaningful words in some textual data, where the more a specific word appears in the text, the bigger and bolder it appears in the word cloud.
  • can be generated in Python using the word_cloud library that was developed by Andreas Mueller.
  • can be easily created using Matplotlib using the scripting layer.

Creating Maps and Visualizing Geospatial Data

Question: What tile style of Folium maps is usefule for data mashups and exploring river meanders and coastal zones?

  • OpenStreetMap
  • Mapbox Bright
  • Stamen Toner
  • Stamen Terrain
  • River and Coastal

Question: You cluster markers superimposed onto a map in Folium using a feature group object.

  • False
  • True

Question: If you are interested in generating a map of Spain to visualize its hill shading and natural vegetation, which of the following lines of code will create the right map for you?

  • folium.Map(location=[40.4637, 3.7492], zoom_start=6, tiles=’Stamen Toner’)
  • folium.Map(location=[40.4637, 3.7492], zoom_start=6, tiles=’Stamen Terrain’)
  • folium.Map(location=[40.4637, -3.7492], zoom_start=6, tiles=’Stamen Terrain’)
  • folium.Map(location=[-40.4637, -3.7492], zoom_start=6, tiles=’Stamen Terrain’)
  • folium.Map(location=[40.4637, 3.7492], zoom_start=6)

Final Exam

Question: Data visualizations are used to (check all that apply)

  • explore a given dataset.
  • perform data analytics and build predictive models.
  • train and test a machine learning algorithm.
  • share unbiased representation of data.
  • support recommendations to different stakeholders.

Question: Matplotlib was created by John Hunter, an American neurobiologist, and was originally developed as an EEG/ECoG visualization tool.

  • False
  • True

Question: What are the layers that make up the Matplotlib architecture?

  • FigureCanvas Layer, Renderer Layer, and Artist Layer.
  • Backend_Bases Layer, Artist Layer, Scripting Layer.
  • Backend Layer, Artist Layer, and Scripting Layer.
  • Backend Layer, FigureCanvas Layer, Renderer Layer, Artist Layer, and Scripting Layer.
  • Figure Layer, Artist Layer, and Scripting Layer.

Question: Using the notebook backend, you can modify a figure after it is rendered.

  • False
  • True

Question: The scripting layer is (check all that apply)

  • comprised mainly of pyplot.
  • an area on which the figure is drawn.
  • a handler of user inputs such as keyboard strokes and mouse clicks.
  • lighter that the Artist layer, and is intended for scientists whose goal is to perform quick exploratory analysis.
  • comprised one one main object – Artist.

Question: Which of the following are instances of the Artist object? (check all that apply)

  • Titles
  • Event
  • FigureCanvas
  • Tick Labels
  • Images

Question: There are three types of Artist objects.

  • False
  • True

Question: Each primitive artist may contain other composite artists as well as primitive artists.

  • False
  • True

Question: Given a pandas dataframe, question, which of the following will create a horizontal barchart of the data in question?

  • question.plot(type=’bar’, rot=90)
  • question.plot(kind=’bar’, orientation=’horizontal’)
  • question.plot(kind=’barh’)
  • question.plot(kind=’bar’)
  • question.plot(kind=’bar’, type=’horizontal’)

Question: Pie charts are relevant only in the rarest of circumstances, and bar charts are far superior ways to quickly get a message across.

  • False
  • True
Box Plot

Question: What do the letters in the box plot above represent?

  • A = Mean, B = Upper Mean Quartile, C = Lower Mean Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Mean, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Median, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Outliers
  • A = Median, B = Third Quartile, C = Mean, D = Inter Quartile Range, E = Lower Quartile, and F = Outliers
  • A = Mean, B = Third Quartile, C = First Quartile, D = Inter Quartile Range, E = Minimum, and F = Maximum

Question: What is the correct combination of function and parameter to create a box plot in Matplotlib?

  • Function = plot, and Parameter = kind, with value = “boxplot”
  • Function = plot, and Parameter = type, with value = “box”
  • Function = plot, and Parameter = kind, with value = “box”
  • Function = box, and Parameter = type, with value = “plot”
  • Function = boxplot, and Parameter = type, with value = “plot”

Question: Which of the lines of code below will create the following scatter plot, given the pandas dataframe, df_total?

regression line plot
  1. import matplotlib.pyplot as plt
  2. plot(kind=’scatter’, x=’year’, y=’total’, data=df_total)
  3. plt.title(‘Total Immigrant population to Canada from 1980 – 2013’)
  4. plt.label (‘Year’)
  5. plt.label(‘Number of Immigrants’)
  1. import matplotlib.pyplot as plt
  2. df_total.plot(type=’scatter’, x=’year’, y=’total’)
  3. plt.title(‘Total Immigrant population to Canada from 1980 – 2013’)
  4. plt.label (‘Year’)
  5. plt.label(‘Number of Immigrants’)
  1. import matplotlib.pyplot as plt
  2. df_total.plot(kind=’scatter’, x=’year’, y=’total’)
  3. plt.title(‘Total Immigrant population to Canada from 1980 – 2013’)
  4. plt.xlabel (‘Year’)
  5. plt.ylabel(‘Number of Immigrants’)
  1. import matplotlib.scripting.pyplot as plt
  2. df_total.plot(kind=’scatter’, x=’year’, y=’total’)
  3. plt.title(‘Total Immigrant population to Canada from 1980 – 2013’)
  4. plt.label (‘Year’)
  5. plt.label(‘Number of Immigrants’)
  1. import matplotlib.scripting.pyplot as plt
  2. df_total.plot(type=’scatter’, y=’year’, x=’total’)
  3. plt.title(‘Total Immigrant population to Canada from 1980 – 2013’)
  4. plt.xlabel (‘Year’)
  5. plt.ylabel(‘Number of Immigrants’)

Question: A bubble plot is a variation of the scatter plot that displays three dimensions of data.

  • False
  • True

Question: Seaborn is a Python visualization library that is built on top of Matplotlib.

  • False
  • True

Question: Which of the choices below will create the following regression line plot, given a pandas dataframe, data_dataframe?

regression line plot
  1. import seaborn as sns
  2. ax = sns.regplot(x=”year”, y=”total”, data=data_dataframe, color=”green”)
  • data_dataframe.plot(kind=”regression”, color=”green”, marker=”+”)
  1. import seaborn as sns
  2. ax = sns.regplot(x=”year”, y=”total”, data=data_dataframe, color=”green”, marker=”+”)
  • data_dataframe.plot(kind=”regplot”, color=”green”, marker=”+”)
  1. import seaborn as sns
  2. ax = sns.regplot(x=”total”, y=”year”, data=data_dataframe, color=”green”)

Question: A word cloud (choose all that apply):

  • is a depiction of the frequency of different words in some textual data.
  • is a depiction of the frequency of the stopwords, such as a, the, and, in some textual data.
  • is a depiction of the meaningful words in some textual data, where the more a specific word appears in the text, bigger and bolder it appears in the word cloud.
  • can be generated in Python using the word_cloud library that was developed by Andreas Mueller.
  • can be easily created using Matplotlib using the scripting layer.

Question: The following are tile styles of folium maps (choose all that apply).

  • Stamen Terrain
  • River Coastal
  • Stamen Toner
  • Mapbox Bright
  • Open Stamen

Question: You cluster markers superimposed onto a map in Folium using a marker cluster object.

  • False
  • True

Question: If you are interested in generating a map of Spain to explore its river meanders and coastal zones. Which of the following lines of code will create the right map for you?

  • folium.Map(location=[40.4637, 3.7492], zoom_start=6, tiles=’Stamen Terrain’)
  • folium.Map(location=[40.4637, 3.7492], zoom_start=6, tiles=’Stamen Toner’)
  • folium.Map(location=[40.4637, -3.7492], zoom_start=6, tiles=’Stamen Toner’)
  • folium.Map(location=[-40.4637, -3.7492], zoom_start=6, tiles=’Stamen Terrain’)
  • folium.Map(location=[40.4637, 3.7492], zoom_start=6)
Conclusion:

We hope you know the correct answers to Data Visualization with Python If Queslers helped you to find out the correct answers then make sure to bookmark our site for more Course Quiz Answers.

If the options are not the same then make sure to let us know by leaving it in the comments below.

Course Review:

In our experience, we suggest you enroll in this and gain some new skills from Professionals completely free and we assure you will be worth it.

This course is available on Cognitive Class for free, if you are stuck anywhere between quiz or graded assessment quiz, just visit Queslers to get all Quiz Answers and Coding Solutions.

More Courses Quiz Answers >>

Building Cloud Native and Multicloud Applications Quiz Answers

Accelerating Deep Learning with GPUs Quiz Answers

Blockchain Essentials Cognitive Class Quiz Answers

Leave a Reply

Your email address will not be published.