0% found this document useful (0 votes)
13 views5 pages

IP Class 12 Answer Key 2021-22

Ip material
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

IP Class 12 Answer Key 2021-22

Ip material
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Saraswati International School

MA 3(2021 - 22)

Informatics Practices[065]

Class: XII [Sci & Com] Max. Marks: 10

General Instructions:

1. This question paper contains two case study questions. Each one is compulsory.
2. Each case study has 5 multiple choice questions.

Q.1 Arunati wants to create multiple bar plot horizontally to represent following tabular data.
Happiness_index Happiness_index Happiness_index
City
Men Women Kids
Delhi 60 30 45
Beijing 40 60 50
Washington 70 70 85
Tokyo 65 55 70
Moscow 85 75 80

(i) Complete the following code to create graph,


import [Link] as pt
import numpy as np
hm=[60,40,70,65,85]
hf=[30,60,70,55,75]
hk=[45,50,85,70,80]
City=['Delhi','Beijing','Washington','Tokyo','Moscow']
a.
x=[Link](len(City))
[Link](City,hm,width=0.25)
[Link](x+0.25,hf,width=0.25)
[Link](x+0.25,hk,width=0.25)

Page. 1
b.
x=[Link](len(City))
[Link](x,hm,width=0.25)
[Link](x+0.25,hf,width=0.25)
[Link](x+0.5,hk,width=0.25)
c.
x=[Link](len(City))
[Link](City,hm,height=0.2)
[Link](x+0.2,hf,height=0.2)
[Link](x+0.4,hk,height=0.2)
d.
x=[Link](len(City))
[Link](City,hm,width=0.2)
[Link](x+0.2,hf, width =0.2)
[Link](x+0.4,hk, width =0.2)

Answer: (c)

(ii) Which option is incorrect to display legend in lower left corner?


a. [Link](loc=3)
b. [Link](loc='lower left')
c. both a and b
d. [Link](loc=2)

Answer: (d)

(iii) Which is correct to display appropriate labels for both axis?


a.
[Link]('Happiness_index')
[Link]('City')
b.
[Link]('City')
[Link]('Happiness_index')
c.
pt.label_x('City')
pt.label_y('Happiness_index')
d.
[Link]='City'
[Link]='Happiness_index'

Answer: (a)

Page. 2
(iv) Which one is incorrect code for displaying appropriate ticks on y-axis?
a.
[Link](x)
b.
[Link](City)
c.
[Link]([0,1,2,3,4])
d.
[Link]([30,40,50,60,70,80,90])

Answer: (d)

(v) Which one is correct code for displaying appropriate ticks on x-axis?

a.
[Link](x)
b.
[Link](City)
c.
[Link]([0,1,2,3,4])
d.
[Link]([10,20,30,40,50,60,70,80,90])

Answer: (d)

Q.2 Raghav wants to display the continuous raise in turnover of ABC company in last 5 years
using Histogram.
turn_over=[300,450,530,600,700]
(i) The following code can be used to display cumulative histogram.
a. [Link](turn_over,cumulative)
b. [Link](turn_over,cumulative=True)
c. [Link](cumulative=True)
d. [Link](turn_over,True)

Answer: (b)

(ii) Following is incorrect type of histogram.


a. bar
b. stepfilled
c. stacked
d. barstacked

Page. 3
Answer: (c)

(iii) Following code can be used to draw horizontal histogram.


a. [Link](turn_over)
b. [Link](turn_over, 'horizontal')
c. [Link](turn_over)
d. [Link](turn_over,orientation='horizontal')

Answer: (d)

(iv) If histogram is created using 5 bins then write code for appropriate x-axis tick marks.
a. [Link]([300,380,460,540,620,700])
b. [Link]([300,350,400,450,500,550,600,650,700])
c. [Link]([300,400,500,600,700])
d. [Link]([100,300,500,700,900])

Answer: (a)

(v) Select appropriate code for saving and displaying graph.


a.
pt.save_fig('[Link]')
[Link]()
b.
[Link]('[Link]')
[Link]()
c.
[Link]('[Link]')
[Link]()
d.
pt.save_fig('[Link]')
[Link]()

Page. 4
Answer: (c)

Page. 5

Common questions

Powered by AI

Common mistakes in setting tick marks on histograms involve misalignment with binning intervals or using inappropriate value ranges. For instance, specifying ticks that don't match the data range or bin counts, such as arbitrary intervals like 'pt.xticks([10,20,30,40,50,60,70,80,90])', leads to inaccurate representation. Proper ticks need alignment with the data distribution and bin edges, such as 'pt.xticks([300,380,460,540,620,700])' in a data range from 300 to 700, which accurately reflects the division intervals of the histogram bins .

The option 'pt.legend(loc=2)' is incorrect for displaying a legend at the lower left corner of a plot using Matplotlib. The correct methods to position the legend at the lower left corner are 'pt.legend(loc=3)' or 'pt.legend(loc='lower left')'. Option 'pt.legend(loc=2)' places the legend at the upper left, which is not the intended position for the lower left corner .

The 'stacked' type of histogram is incorrectly configured in the context given. While 'bar', 'stepfilled', and 'barstacked' are valid configurations, 'stacked' alone is not recognized as a specific type in Matplotlib’s histogram types. The correct naming for stacking bars within histograms would involve different arguments or configurations, such as 'barstacked' within 'plt.hist()', correctly using parameters to stack different categories within the same histogram .

To implement a horizontal histogram for displaying business turnover data over time in Matplotlib, you should use the 'orientation' parameter within the 'plt.hist()' function. The syntax is 'plt.hist(turn_over, orientation='horizontal')', where 'turn_over' is the array containing the turnover values. This configuration specifies that the histogram bars should be oriented horizontally rather than the default vertical arrangement .

When creating a histogram to illustrate cumulative turnover data using Matplotlib, it is important to use the 'cumulative=True' parameter in the 'pt.hist()' function to appropriately display cumulative figures. This parameter modifies the histogram calculation to produce a cumulative sum of the turnovers, effectively showing how the turnover grows over time. The correct syntax to implement this is 'pt.hist(turn_over, cumulative=True)', where 'turn_over' is the data array representing turnover values .

The correct procedure to save and display a Matplotlib graph involves using the 'pt.savefig()' and 'pt.show()' functions respectively. To save the graph, use 'pt.savefig('plot.pdf')', specifying the filename and format. To subsequently display the graph, use 'pt.show()', which renders the plot in a new window. This two-step process ensures the graph is both preserved as a file and visually confirmed on screen, allowing for post-analysis review .

For setting x-axis tick marks in a histogram with 5 bins when plotting turnover data using Matplotlib, an appropriate sequence would be 'pt.xticks([300,380,460,540,620,700])'. This sequence ensures that the tick marks are aligned with the bin edges calculated using the binning intervals of the turnover data, providing clear demarcations on the x-axis corresponding to the distribution of turnover amounts .

The option 'pt.yticks([30,40,50,60,70,80,90])' is incorrect for displaying appropriate y-axis ticks in this particular context. Appropriate y-axis ticks should match the categorical data they represent, such as indices for cities, instead of arbitrary numbers that do not align with any meaningful data intervals. A more appropriate choice would involve setting ticks that match city indices or use meaningful breaks for the plotted data. Thus, options like 'pt.yticks(x)' or 'pt.yticks(City)' are typically appropriate .

To correctly label the axes of a Matplotlib plot that represents city happiness indices, the commands 'pt.xlabel('Happiness_index')' and 'pt.ylabel('City')' should be used. This configuration ensures that the x-axis is labeled with the quantitative data (happiness indices) and the y-axis is labeled with the categorical data (cities), correctly representing the relationship between the indices and their respective cities .

To create horizontal bar plots for happiness indices of different demographics using Matplotlib, you would import the necessary libraries and define the data arrays for men, women, and kids happiness indices. The correct implementation involves using the 'barh' function for horizontal bars. The code should use numpy for setting up indices with np.arange() and specify bar positions by adjusting the index by an increment for each demographic group. Specifically, you should use the following snippet: 'x=np.arange(len(City)); pt.barh(City,hm,height=0.2); pt.barh(x+0.2,hf,height=0.2); pt.barh(x+0.4,hk,height=0.2)'. This code snippet ensures that separate horizontal bars are plotted for each group with a distinct offset .

You might also like