# Important QnA Histogram for Class 12 IP

Important QnA Histogram for Class 12 IP which is part of Chapter 3 Plotting with Pyplot. So here we go!

Topics Covered

## Imortant QnA Histogram for Class 12 IP – Objective type questions (1 Mark)

### Fill in the blanks, MCQs and True/False

 A __________ is a tool that summarize discrete or continuous data.

–> Histogram

 The numerical data shown by the number of data points that fall within a particular range is called _______.

–> bins

 A histogram is a similar to a vertical bar graph. [True/False]

 Which of the following data can be shown by histogram?

a) The quantity like weight, height, time

b) The categories

c) The uncountable data

d) All of these

 The histogram was introduced by _________

–> Karl Pearson

 A ______ function is used to create histogram.

–> hist()

 How many parameters a hist() function can have?

a) 2

b) 3

c) 4

d) 5

 A _______ is a boolean parameter of hist() funtion which is by default False.

–> cumulative

A _____ parameter is just a number or series or arrays to be plotted on histogram.

–> x

 Which of the following is traditional bar-type histogram?

a) x

b) bins

c) histtype

d) orientation

 Which of the following parameter have values like horizontal or vertical?

a) x

b) bins

c) histtype

d) orientation

 Which of the following is the correct statement to create a histogram with ndarray x and bins value 30?

a) hist(x,bins:30)

b) hist(x,bins=30)

c) hist(x,bins-30)

d) hist(x,bins,30)

 A ________ value should be specified to histtype to generate a lineplot that is by default unfilled.

–> step

You cannot create horizontal stacked histogram. (True/False)

 Which of the following is correct to generate horizontal stacked histogram?

a) hist([x,y], histtype=’barstacked’, orientation = ‘horizontal’)

b) hist([x,y], histtype=’horizontal’, orientation=’barstacked’)

c) b) hist([x,y], histtype=’horizontal’, orientation=’landscape’)

d) None of these

### Histogram for Class 12 IP – Conceptual Descriptive/Subjective Questions

 Describe the histogram. How to plot data on histogram?

 Explain hist() function in detailed.

 Clarify the situations when you need to use bar() charts and when you need to use hist() chart?

What is the significance of the cumulative histogram? Elaborate your answer with an example.

 How to change the edgecolor and color of histogram bar?

 Explain the following parameters of hist() function with example.

1. bins
2. histtype
3. orientation

 How to save the histogram as image?

## Histogram for Class 12 IP – Application-based questions

 Write code to plot following data on histogram:

24,17,14,22,25,26,38,42,24,12,28,19,32,21,35,28,21,31,18,19

``````import matplotlib.pyplot as mp
l=[24,17,14,22,25,26,38,42,24,12,28,19,32,21,35,28,21,31,18,19]
mp.hist(l)
mp.show()``````

 Generate random numbers from 1 to 70 and plot it on the histogram. Change the outline color to black and the bar color should be yellow.

``````import matplotlib.pyplot as m
import numpy as np
x=np.random.randn(70)
m.hist(x,20,edgecolor="black",facecolor="yellow")
m.show()``````

 Display the above data in cumulative mode on histogram.

import matplotlib.pyplot as m
import numpy as np
x=np.random.randn(70)
m.hist(x,20,cumulative= True, edgecolor=”black”,facecolor=”yellow”)
m.show()

 Write python code to create histogram based on given data:

rcb: 78,63,49,41,68,101,56,79,68,96

mi: 45,85,98,102,42,50,43,48,63,39

``````import matplotlib.pyplot as m
rcb=[78,63,49,41,68,101,56,79,68,96]
mi=[45,85,98,102,42,50,43,48,63,39]
m.hist([rcb,mi],cumulative='true')
m.show()``````

 Draw histogram for the following code:

``````import matplotlib.pyplot as m
english=[77,66,88,99,55,44,33,79,68,83]
maths=[56,89,70,50,60,65,90,80,47,82]
m.hist([english,maths], orientation='horizontal')
m.show()``````

Share with your friends and classmates. Feel free to ask your doubt in the comment section as well.

Unlock following link to get the pdf solution.

Watch this video for more understanding.

Share this video with your friends and in your circle. If you have any doubts or queries feel free to write in the comment section.

Your suggestions/views/feedbacks are always welcome. Write your views/suggestions/feedbacks in the comment section to improve our contents.

If you have any other concern related to out blog you can use our contact us section to inform us. We will try to resolve the concern.

Thank you for visit.