100% found this document useful (1 vote)
147 views

Worksheets (6-10) Data Visualisation

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
147 views

Worksheets (6-10) Data Visualisation

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION

CLASS XII :– INFORMATICS PRACTICES (065)


TOPIC :- DATA VISUALISATION (UNIT – 1)

Roll No: ................. 2023-24 Date: …….…………..…


Name of the Student: ……………………………………………
WORKSHEET - 1

1. A ……………………. graph is a type of chart which displays information as a series of


data points connected by straight line segments.
a. line b. bar c. pie d. boxplot
2. Which function lets you set the title of plot?
a. title () b. plottitle() c. graphtitle() d. All of the above
3. Pyplot’s ………………. function is used to create a vertical bar charts.
(bar() / barh())
4. Pyplot interface is a collection of methods within …………... library of python.
5. Which of the following is not a valid plotting function of pyplot?
a. plot () b. bar() c. line() d. pie()
6. ……………………. is the function to save the graph.
a. save.figure() b. savefig() c. Save.figure() d. Savechart()
7. Which graph should be used where each column represents a range of values, and
the height of a column corresponds to how many values are in that range?
a. plot b. bar c. boxplot d. histogram
8. Which function is used to create a histogram ?
a. histo() b. histogram() c. hist( ) d. histype()
9. What is the purpose of a legend?
10. The ______ module allows you to represent data visually in various forms.
11. The ________ library provides the interface and functionality for plotting the
graphs.
12. A __________ chart displays information as a markers connected by a straight
lines.
13. A bar chart is also known as column chart. (True/False)
14. Which is a common method used to plot data on the chart?
a) plot() b) show()
c) legend() d) title()
15. To give a title to x-axis, which of the following method is useful?
a) pl.xtitle(“title”) b) pl.xlabel(“title”)
c) pl.xheader(“title”) d) pl.xlabel.show(“title”)
16. The pl.show() method must be used to display the chart in the end of the chart
specification. (True/False)
17. The _________ method is used to create a line chart.
a) pl.pie() b) pl.col()
c) pl.plot() d) pl.line()
18. To create a horizontal bar chart, bar() function is used. (True/False)
19. To change the width of bars in bar chart, which of the following argument with a
float value is used?
a) thick b) thickness
c) width d) barwidth

67 | P a g e
20. You can set different width for different bars in bar chart. (True/False)
21 If you are given to plot a histogram using numpy array as per the code given below
then answer any of four question from (i) to (v)

from matplotlib import _____ as plt #line 1


import numpy as np
fig, ax = plt.______ (1, 1) #line 3
a= np.array([26,59,44,39,76,16,23,11,18,78])
ax.hist(a, bins=[0,10,20,30,40])
ax._____ (‘Histogram’) #line 6
ax.set_xticks ([0,10,20,30,40, ])
ax.set_xlabel(‘Percentage’)
ax._______ (‘Students’) #line 9
______ #line 10
(i) Choose the correct option to import for given program:
(a) matplotlib (b) matplot
(c) pyplot (d) plot

(ii) Fill in the blank at Line 3


(a) subplots (b) subplot
(c) plot (d) subplt

(iii) Which statement is used to set title in Line 6 ?


(a) title (b) set_title
(c) set (d) Title

(iv) How to set Y-axis label ?


(a) label() (b) set_y
(c) set_ylab() (d) set_ylabel

(v) To fill in blank on Line 10 for showing histogram what can beeused ?
(a) plt.show() (b) plt_show()
(c) plot_show() (d) plt.show

************

68 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)

Roll No: ................. 2023-24 Date: …….………….…


Name of the Student: ……………………………………………

WORKSHEET - 2

1. What is true about Data Visualization?


A. Data Visualization is used to communicate information clearly and efficiently to
users by the usage of information graphics such as tables and charts.
B. Data Visualization helps users in analyzing a large amount of data in a simpler
way.
C. Data Visualization makes complex data more accessible, understandable, and
usable.
D. All of the above
2. Which method is used to save the output of pyplot in the form of image file ?
A. savefig(‘filename’)
B. save_fig(‘filename)
C. save_figure(‘filename’)
D. save_img(‘filename’)
3. Data visualization is also an element of the broader _____________.
A. deliver presentation architecture
B. data presentation architecture
C. dataset presentation architecture
D. data process architecture
4. The command used to give a heading to a graph is _________
A. plt.show()
B. plt.plot()
C. plt.xlabel()
D. plt.title()
5. Common use cases for data visualization include?
A. Politics
B. Sales and marketing
C. Healthcare
D. All of the above
6. Which are pros of data visualization?
A. It can be accessed quickly by a wider audience.
B. It can misrepresent information
C. It can be distracting
D. None Of the above
7. Which are cons of data visualization?
A. It conveys a lot of information in a small space.
B. It makes your report more visually appealing.
C. visual data is distorted or excessively used.
D. None Of the above
8. Identify the right type of chart using the following hints.
Hint 1: This chart is often used to visualize a trend in data over intervals of time.
Hint 2: The line in this type of chart is often drawn chronologically.
A. Line chart

69 | P a g e
B. Bar chart
C. Pie chart
D. Scatter plot
9. Which method is used to plot horizontal bar graph in pyplot ?
A. horizontal_bar()
B. barh()
C. hbar()
D. bar()
10. Which method is used to plot histogram in pyplot?
A. his()
B. hist()
C. Hist()
D.histogram()

11. Consider the following program and answer any four question from (i) to
(v):
import _______ as plt #line 1
plt.bar ([2,3,4,8,1],[2,4,7,3,5], label= _____ ) #line 2
plt.legend( ) #line 3
plt.xlabel(____ ) #line 4
plt.ylabel(‘Height’) #line 5
plt._______ (‘Vertical Bar Chart’) #line 6
________________ #line 7

(i) Which Module will be imported in Line 1 for above code ?


a) matplotlib (b) matplotlib.pyplot
b) plotlib (d) None of these

(ii) Name the label that can be used to represent the bar chart in Line 2 .
a) Data (b) Data Values
b) Values for X axix (d) All of these

(iii) Which message is best suited for xlabel ?


a) X values (b) Y values
b) Legend (d) Vertical

(iv) Which method will take place at Line 6 for setting heading on the top of Chart ?
(a) Title() (b) title()
(c) Head() (d) All of these.

(v) Choose the statement to be place at Line7 of the above code .


(a) Plt.print() (b) plt.show()
(c) Plt.display() (d) plot.show()

12. Consider the following case and answer the from (i) to (v)

70 | P a g e
import …………. as pd #line 1
import matplotlib. _____ as plt #line 2
data= {‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’, ‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]}
df=pd. _________ (data) #line 6
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2, linestyle=’:’ , fill= False)
#line 7
_____________ #line 8

(i) Fill in the blank in Line 1.


(a) numpy (b) pandas
(c) Python (d) matplot
(ii) Fill in the blank in Line 2.
(a) pyplot (b) plot
(c) pyp (d) None of these
(iii) Which of the following is used in Line 6 to represent the data ?
(a) Series (b) Matplot
(c) DataFrame (d) Plot
(iv) For blank of Line 7 command used may be :
(a) plt (b) pyplot
(c) plot (d) figure
(v) To show the above graph , which statement is used in Line 8 ?
(a) plot.sho (b) plot.show()
(c) plt.show (d) plt.show()

13. Mr. Vijay is working in the mobile app development industry and he was
comparing the given chart on the basis of the rating of the various apps available
on the play store and answer the questions (i) to (v).

71 | P a g e
He is trying to write a code to plot the graph. Help Mr. Vijay to fill in the blanks of the
code and get the desired output.

import ________________ as plt #Statement 1


apps=["ArogyaSetu","WPS Office","CamScanner","WhatsApp","Telegram"]
ps_rating=[3.9,4.5,4.6,4.2,4.3]

plt.__________(apps,ps_rating,color='m',label=__________) #Statement 2
,Statement 3
plt.xlabel("Apps")
plt._____________("Rating") #Statement 4
plt._________ #Statement 5
plt.________ #Statement 6

i) Write the appropriate statement for #statement 1 to import the module.


ii) Write the function name and label name as displayed in the output for #statement 2
and #statement 3 respectively.
iii) Which word should be used for #statement 4?
iv) Write appropriate method names for #Statement 5 to display legends and
#Statement 6 to open the figure.
v) Mr. Vijay wants to change the chart type to a line chart. Which statement should be
updated and which method or function is used?

************

72 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)

Roll No: ................. 2023-24 Date: …….………….…


Name of the Student: ……………………………………………

WORKSHEET - 3

1. What is the purpose of the Matplotlib library?


2. What are some of the major components of any graphs or plot?
3. Name the function which is used to save the plot.
4. Write short notes on different customization options available with any plot.
5. What is the purpose of a legend?
6. Define Pandas visualization.
7. Name the plot which displays the statistical summary.
8. Compare bar() and barh() functions.
9. What is the role of legends in a graph/chart?
10. What do you understand by x limit and ylimit ? How are theses linked to data being
plotted?
11. When should you use (i) a line chart (ii) a bar chart (iii)a pie chart?
12. A company has three offices across India: Delhi, Mumbai, Kolkata. Each of the
offices has sent a compiled list sharing sales in quarter1, quarter2, quarter3 and
quarter4.
(a) Suggest the best chart type to plot all the above data?
(b) Why did you choose that specific chart type?
(c) Can you create a pie chart from above data?

**************

73 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)

Roll No: ................. 2023-24 Date: …….………….…


Name of the Student: ……………………………………………

WORKSHEET - 4

1. Plot the following data using a line plot:


Day 1 2 3 4 5 6 7

Tickets Sold 2000 2800 3000 2500 2300 2500 1000

 Before displaying the plot display “Monday, Tuesday, Wednesday, Thursday,


Friday, Saturday, Sunday” in place of Day 1, 2, 3, 4, 5, 6, 7
 Change the color of the line to ‘Magenta’.

2. Collect data about colleges in Delhi University or any other university of your choice
and number of courses they run for Science, Commerce and Humanities, store it in a
CSV file and present it using a bar plot.

3. Collect the minimum and maximum temperature of your city for a month and present
it using a histogram plot.
4. Plot the following data on line chart:
Runs in Overs 10 20

MI 110 224

RCB 85 210

5. Write code to plot a line chart to depict the run rate of T20 match from given data:
Overs Runs

5 45

10 79

15 145

20 234

6. Plot following data on bar graph:


English: 56,78,90,34
Science: 65,77,54,32
Maths: 45,67,43,41

7. How to change the thickness of line, line style, line color, and marker properties of
a chart?

74 | P a g e
8. Mrs. Sharma is a coordinator in the senior section school. She represented data on
number of students who passed the exam on line chart as follows:

She has written the following code but not getting the desired output. Help her
by correcting her code.

import matplotlib.pyplot as plt


CLASSes=["X A","X B","XI A","XI B","XII A","XII B"]
no_of_boys=[23,22,20,26,33,30]
no_of_girls=[17,10,20,12,5,8]
plt.line(CLASSes,no_of_boys) #Statement 1
plt.line(CLASSes,no_of_girls) #Statement 2
plt.xtitle("No of Stduents") #Statement 3
plt.ytitle("CLASSes") #Statement 4
plt.show()

i. What will be the correct code for Statement 1 and Statement 2?


ii. What is the correct function name for Statement 3 and Statement 4?
iii. Write a method and parameter required to display legends?
iv. Name the parameter and values used to apply the marker as given in the output.
v. Name the parameter and values used to apply linestyle as given in the output.
vi. How to apply the line colours as given in the figure?
vii. Write to save the figure as image.

*************

75 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)

Roll No: ................. 2023-24 Date: …….………….…


Name of the Student: ……………………………………………

WORKSHEET - 5
1. Consider that a survey has to be done on how much distance the following vehicles have
covered in a span of five days. The data collected can be plotted in different plotting methods.
plot the data using Line plot:

BIKES
DAYS DISTANCE COVERED IN KMS
ENFIELD HONDA YAHAMA KTM
DAY 1 50 80 70 80
DAY 2 40 20 20 20
DAY 3 70 20 60 20
DAY 4 80 50 40 50
DAY 5 20 60 60 60
2. Consider question No.9 and plot the data using Bar Chart.
3. Consider question No.9 and plot the data using Pie Plot.
4. Consider question No.9 and plot the data using Scatter Plot.
5. Consider question No.9 and plot the data using Histogram Plot.

6. Write a Python program to draw line charts from the given financial data of ABC Co.
for 5 days in the form a DataFrame namely fdf as shown below :
Day1 Day2 Day3 Day4 Day5
0 74.25 56.03 59.30 69.00 89.65
1 76.06 68.71 72.07 78.47 79.65
2 69.50 62.89 77.65 65.53 80.75
3 72.55 56.42 66.46 76.85 85.08
7. Write a program to create a horizontal bar chart for India's medal tally.

Country Gold Silver Bronze Total

Australia 80 59 59 198

England 45 45 46 136

India 26 20 20 66

Canada 15 40 27 82

8. Write a python code to draw the following bar graph representing the total sales in
each quarter. Add the title, label for X-axis, Y-axis. Use the following data for
plotting the graph.

76 | P a g e
Sales = [450,300,500,850]
Qtr = [“Qtr1”, “Qtr2”, “Qtr3”,”Qtr4”]

77 | P a g e

You might also like