# Class 12 IP Pandas MCQ Questions

## Data visualization Class 12 IP MCQ

OBJECTIVE TYPE QUESTIONS
1. Fill in the blanks.
(a) …………….. refers to the graphical or visual representation of information and data using visual
elements like charts, graphs and maps, etc.
(b) …………….. is a collection of methods with matplotlib library which allows the user to construct 2D
plots easily and interactively.
(c) The …………….. chart is a graph of plotted points on two axes that shows the relationship between
two sets of data.
(d) …………….. is the text that appears on the top of the plot and defines what the chart is about.
(e) The axes of a plot can be labelled using …………….. and …………….. functions.
(f) A …………….. is a summarization tool for discrete or continuous data.
(g) Pyplot module’s …………….. lets you create histograms.
(h) In a …………….., the number of observations is marked with a single point at the midpoint of an
interval.
(i) The …………….. is used to show the range and the middle half of the ranked data.
(j) The …………….. module of Pyplot lets you draw box plots.
(k) Two functions of Pyplot library used to create scatter charts are ……………. and ……………. .
(l) Barh() function is used to create …………….. bar chart.
(m) The area on which actual plot will appear is defined by …………….. .
(n) …………….. describe the number of data points that fall within a specified range of values.
(o) To change the orientation of the histogram, we can use …………….. argument with hist().

(a) Data Visualization (b) Pyplot (c) scatter
(d) Title (e) xlabel(), ylabel() (f) histogram
(g) hist() (h) frequency polygon (i) box plot
(j) boxplot() (k) plot(), scatter() (l) horizontal
(m) axes (n) Bins (o) orientation

2. State whether the following statements are True or False.

(a) The matplotlib is a Python interface.
(b) To save the plot, we have to use save graph() function.
(c) Frequency polygons are drawn with respect to the histogram created.
(d) The box plot is also described as five-number summary plot.
(e) In box plot, the highest and lowest scores are not joined to the box by straight lines.
(f) Plot can be saved in a pdf format.
(g) We can specify different colours for different bars of a bar chart.
(h) To use Pyplot for data visualization, we have to import it by giving import command for matplotlib.
pyplot.
(i) Pyplot is a Python library.
(j) Frequency polygon is a type of frequency distribution graph.
(k) To specify a common width for all bars in a bar graph, we have to use thick argument.
(l) To add a Title to the plot, we have to call function header().
(m) Markers are data points in the graphs.
(n) Line style argument of plot() function is not required in scatter chart.
(o) When we don’t specify X or Y limits for a plot, then Pyplot does not automatically decide limits as
per values being plotted.
Answers: (a) False (b) False (c) True (d) True (e) False (f) True
(g) True (h) True (i) False (j) True (k) False (l) False
(m) True (n) True (o) False
3. Multiple Choice Questions (MCQs)
(a) Which Python package is used for 2D graphics?
(i) matplotlib.pyplot (ii) matplotlib.pip
(iii) matplotlib.numpy (iv) matplotlib.plt
(b) The most popular data visualization library in Python is:
(i) pip (ii) matinfolib (iii) matplotlib (iv) matpiplib
(c) Matplotlib allows you to create:
(i) table (ii) charts (iii) maps (iv) infographics
(d) Which of the following is not a visualization under matplotlib?
(i) Scatter plot (ii) Histogram (iii) Box plot (iv) Table plot
(e) Which plot displays the distribution of data based on the five-number summary?
(i) Scatter plot (ii) Line plot (iii) Box plot (iv) Chart plot
(f) Which of the following commands is used to install matplotlib for coding?
(i) import plt.matplotlib as plot (ii) import plot.matplotlib as pt
(iii) import matplotlib.plt as plot (iv) import matplotlib.pyplot as plt
(g) Which of the following methods should be employed in the code to display a plot()?
(i) show() (ii) display() (iii) execute() (iv) plot()

(h) Which of the following statements is used to create a histogram of ‘step’ type with 20 bins?
(i) plt.hist(x, bins=20,histype=“barstacked”) (ii) plt.hist(x, bins=20)
(iii) plt.hist(x, bins=20,histype=“step”) (iv) plt.hist(x, bins=20,histype=hist()
(i) Which of the following plots makes it easy to compare two or more distributions on the same set of
axes?
(i) Box plot (ii) Histogram (iii) Frequency Polygon (iv) Bar chart

(j) The part of chart which identifies different sets of data plotted on plot by using different colours is
called:
(i) legends (ii) title (iii) axes (iv) figure
(k) Which of the following is an incorrect example of savefig() function?
(i) plt.savefig(“bar1.pdf”) (ii) plt.savefig(“bar1.png”)
(iii) plt.savefig(“bar1.eps”) (iv) plt.savefig(“bar1.ppt”)

(l) Which of the following plots makes it easy to compare two or more distributions on the same set of
axes?
(i) Box plot (ii) Histogram (iii) Frequency polygon (iv) Bar chart
(m) Consider the snippet given below:
import matplotlib.pyplot as plt
#arr1,arr2 defined here
colors=[‘r’,‘b’,‘k’,‘g’,‘m’]
sizes=[50,120,220,150,80]
plt.scatter(arr1,arr2, c=colors, s=sizes, marker=“s”)
With reference to the above code, what will be the shape of marker?
(i) square (ii) circle (iii) star (iv) diamond
(n) With reference to the code in (m), what will be the colour of the last point?
(i) Red (ii) Blue (iii) Black (iv) Magenta
(o) The scatter() function:
(i) is a powerful method of creating scatter plots than plot() function
(ii) can create line graph
(iii) can create bar graph
(iv) None of the above

Answers: (a) (i) (b) (iii) (c) (ii) (d) (iv) (e) (iii) (f) (iv)
(g) (i) (h) (iii) (i) (iii) (j) (i) (k) (iv) (l) (iii)
(m) (i) (n) (iv) (o) (i)

SOLVED QUESTIONS
1. What is Python matplotlib?
Ans. matplotlib.pyplot is a plotting library used for 2D graphics in Python programming language. It can be
used in Python scripts, shell, web application servers and other graphical user interface toolkits.
2. How can we install matplotlib?
Ans. It is easy to install Python matplotlib library with pip statement – pip install matplotlib.
3. What are the various types of plots offered by matplotlib?
Ans. Matplotlib offers several types of plots:
• Line Graph
• Bar Graph
• Histogram
• Scatter Plot
• Area Plot
• Pie Chart

4. What is data visualization? What is its significance?
Ans. Data visualization is a general term that describes any effort to help people understand the significance
of data by placing it in a visual context. In simple words, Data visualization is the process of displaying
data/information in graphical charts, figures and bars.

5. Name the functions you will use to create a (i) line chart, (ii) bar chart, (iii) scatter chart.
Ans. (i) matplotlib.pyplot.plot()
(ii) matplotliblpyplot.bar()
(iii) matplotlib.pyplot.plot() and matplotlib.pyplot.scatter()

## Class 12 IP MCQ questions Chapter 1

MCQs
Q.1 What is the correct syntax to return both the first row and the second row in a Pandas DataFrame df?
A. df.loc[[0,1]] B. df.[[0,1]]
C. df.loc[[0-1]] C. df.[[0-1]]
Ans. A

Q.2 If df is a dataframe then print(df) will print
A. The first ten rows B. The first five rows
C. The first five and last five rows D. The first ten and the last ten rows
Ans. C

Q.3 The following table shows the python code and its expected output. Choose the correct word for blank
space in line 3 for printing the column:
A. index B. column C. col D. heads
Python code Output
1 import pandas as pd
2 x = [10, 20 30]
3 ser = pd.Series(x, _______=[“r1”, “r2”, “r3”])
4 print(ser)
r1 10
r2 20
r3 30
Ans. A

Q.4 What is the correct output for following Python code:
import pandas as pd
data = {“Marks1”: 90, “Marks2”: 95, “Marks3”: 97}
ser = pd.Series(data)
print(ser)
A. Marks1 90
Marks2 95
Marks3 97
dtype: int64
B. Marks1 90
Marks2 95
Marks3 97
dtype: int16
C. Marks1 Marks2 Marks3
90 95 97
D. Marks1 Marks2 Marks3
90 95 97
dtype: int64
Ans. B
Q.5 Pandas Series can be created from:
A. Scalar values B. NumPy arrays
C. dictionary D. All of the above
Ans D

3 | P a g e
Q.6. Which is the best analogy of digital footprint:
A. Our foot print when we walk over sand of sea beach
B. Our foot print when we walk over the cement road constructed few minutes back
C. our foot print when we enter inside our home with dirty feets.
D. All of the above
Ans B (since after drying, foot prints are retained for years)

Q.7 . Digital footprint are not created :
A. when we do online shopping
B. when we create our e-mail address
C. when we watch youtube videos
D. When we send e-mail
Ans C
Assertion and Reason based questions
Q. 8:
Assertion (A) : pandas is an open source Python library which offers high performance, easy-to-use data
structures and data analysis tools.
Reason (R) : Professionals and developers are using the pandas library in data science and machine learning.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is not the correct explanation of A
C. A is true but R is false
D. A is false but R is true
E. Both A and R are false
Ans A
Q. 9:
Assertion (A) : Data visualization refers to the graphical representation of information and data using visual
elements like charts, graphs and maps etc.
Reason (R) : To install matplotlib library we can use the command
pip install matplotlib.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is not the correct explanation of A
C. A is true but R is false
D. A is false but R is true
E. Both A and R are false
Ans B
Q. 10:
Assertion (A) : Digital footprint is the trail of data we leave behind when we visit any website (or use any
online application or portal) to fill-in data or perform any transaction.
Reason (R) : While online, all of us need to be aware of how to conduct ourselves, how best to relate with
others and what ethics, morals and values to maintain.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is not the correct explanation of A
C. A is true but R is false
D. A is false but R is true
E. Both A and R are false
Ans B

## Class 12 IP MCQ Questions 2021

4 | P a g e
Q. 11:
Assertion (A) : An Internet troll is a person who deliberately sows discord on the Internet by
starting quarrels or upsetting people.
Reason (R) : We can download and use any material available on the Internet.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is not the correct explanation of A
C. A is true but R is false
D. A is false but R is true
E. Both A and R are false
Ans C
Q. 12:
Assertion (A) : Social media are websites or applications that enable their users to participate in social
networking but they cannot create and share content with others in the community.
Reason (R) : We should not waste precious time in responding to unnecessary emails or comments unless they
have some relevance for us.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is not the correct explanation of A
C. A is true but R is false
D. A is false but R is true
E. Both A and R are false
Ans D

Case Study based questions
Q.13 ABC Enterprises is selling its products through three salesmen and keeping the records of sales done
quarterly of each salesman as shown below:
Quarter 1 Quarter 2 Quarter 3 Quarter 4
Salesman 1 23000 18000 30000 35000
Salesman 2 11000 15000 20000 22000
Salesman 3 60000 40000 35000 55000
Company is storing the above information in a CSV file “Qtrly_Sales.csv”. Mr. Rohit is a programmer.
Company has given him the responsibility to create the program to visualise the above data. He wrote Python
code but he is facing some difficulties. Help him by giving the solutions of following situation:
Python code:
1 import pandas as pd
2 import ________________ as plt
3 df=__________(“Qtrly_Sales.csv”)
4 df.plot(__________=’bar’, color=[‘red’,’blue’,’brown’,’green’])

5 | P a g e
5 plt.___________(‘Quarterly Report’)
6 plt.xlabel(‘Salesman’)
7 plt.ylabel(‘Sales’)
8 plt._________()
1. Choose the correct Python library out of following options in line 2
A. matplotlib B. matplotlib.plot
C. py.plot D. matplotlib.pyplot
Ans. D

2. Choose the correct option to read the csv file in line 3
C. pd.get_csv D. get_csv
Ans B

3. Choose the correct option to select the type of graph in line 4
A. type B. kind
C. style D. graph
Ans B

4. Choose the correct word to give the heading in line 5
C. title D. caption
Ans C
5. Choose the correct word to display the graph in line 8
A. plot() B. display()
C. showgraph() D. show()
Ans D
Q.14. Abhishek uses computer and mobile for his personal use. Study the following cases and answer the
questions given below.
(1) Once he got the message in Whatsapp that CBSE is announcing the result of class XII tomorrow at
12:00 pm. He forwarded the message to his few friends. But later he came to know that no such
announcement was there in CBSE official web-site.
(2) He is visiting several web-sites.
(3) He is getting abuse messages from an unknown number due to which he is thinking of quarreling with
that person.
(4) He registered himself in one website by giving his email id and phone number but later his friend told
him about the concept of digital footprint. He is now thinking about canceling the registration so that his
personal information can be deleted from that website.
somewhere on Internet
a. In case (1), he is violating :
A. net etiquettes B. Communication etiquettes
C. copy right D. None of the above
Ans B

6 | P a g e
b. In case (2) , he is leaving:
A. Active digital footprint B. Passive digital footprint
C. There is no chance of any digital footprint
D. None of the above
Ans B

c. In case (3), the unknown person can be called as:
A. Cyber buller B. Internet troll
C. Hacker D. Cracker
Ans B

d. In case (4) which one is correct:
A. His data will be deleted forever after cancelling the registration.
B. His data will be deleted after 30 days since it is a digital footprint.
C. His data will never be deleted since it became the digital footprint.
D. As per the terms and condition of that website, data will be deleted.
Ans C
e. In case (5), he may be violating:
A. copyright B. Intellectual property right
C. plagiarism D. None of the above
Ans A
MCQ for Term 1
Name of the teacher prepared: Ajitha PGT CS Name of the teacher vetted: Prabhod PGt CS
Sub: Informatics Practices
Topics: Data structures in Pandas – Series and data frames. Series: Creation of series from dictionary, scalar value;
mathematical operations; series attributes, head and tail functions; selection, indexing and slicing.
1. Consider the following python code and write the output for statement S1:
import pandas as pd
K=pd.Series([2,4,6,8,10,12,14])
print(K.quantile([0.50,0.75]) #S1
a. 0.50 8.0
b. 0.75 11.0
c. 0.50 8.0
0.75 11.0
d. 0.75 11.0
0.50 8.0
2. Which of the following statements about Pandas and Numpy are True?
a. A Numpy array requires homogeneous data, while a Pandas DataFrame can have different data types.
b. Pandas is used when data is in Tabular Format, whereas Numpy is used for numeric array based data
manipulation.
a. Both are true.
b. A is true, B is false
c. Ais false, B is true
d. Both are false
3. Consider the given python program:
import _______ as pd #S1
series1 = _______.Series([10,20,30]) #S2
print(series1)

Fill the blank in S1 with the correct option:
a. Matplotlib
b. Matplotllib.pyplot
c. Numpy
d. Pandas
4. Fill the blank in S2 with the correct option:
a. pd
b. series1
c. Series
d. Pyplot
5. What will be the output of the code in Q.no. 6?
a. [10,20,30]
b. 0 10
1 20
2 30
c. 10
20
30
d. 10 1
20 2
30 3
6. Which of the following are not true?
A. If we do not explicitly specify an index for the data values while creating a series of N data elements,by
default indices range from 0 through N.
B. We cannot assign user-defined labels to the index and use them to access elements of a Series
C. We can create a series with numeric index in random order.
a. A only
b. A, B
c. B, C
d. C only

## IP MCQ Questions Class 12

Go below for mcq and pdf file

## IP MCQ questions Class 12 Term 1

10. Pushp, a student of class-XII, has been assigned a code to create a pandas series S1, as shown below.
a 100
b 200
c 300
d 400
e 500
dtype: int64
With reference to the above, answer the given questions:
i. Choose the command that will give the following output:
b 200
c 300
dtype: int64
a. print(S1[:3])
b. print(S1[0:3])
c. print(S1[2:4])
d. print(S1[1:3])
ii. Help him to identify the correct statement that can be used to extract the value with the index ‘c’:
a. print(S1[c])
b. print(S1(c))
c. print(‘S1’ [‘c’])
d. print(S1 [‘c’])

iii. Which of the following command will give the following output:
b 200
d 400
dtype: int64
a. print(S1.iloc[1:4])
b. print(S1.iloc[2:4])
c. print(S1.iloc(1:4))
d. print(S1.iloc[1:4:2])

iv. Which of the following command will display the series by adding 10 in eachvalue.
a. print(S1 [+10])
b. print(S1+10)
c. print(S1)+10
d. print(S1)+print(10)

v. Pushp wants to delete the value against index ‘d’. Help him to choose the suitable option to do so:
a. S1=S1.drop(d)
b. S1=S1.drop(‘d’)
c. S1=drop(‘d’)
d. S1=S1.drop[‘d’]

11 | P a g e
11. Answer the question based on the Assertion A and Reason R given.
A:A Series is a one-dimensional array containing a sequence of values of any data type (int, float, list, string, etc).
R:Pandas Series can be imagined as a column in a spreadsheet.
a. Both A and R are true and R is the correct explanation of A.
b. Both A and R are true but R is not the correct explanation of A.
c. A is true but R is false.
d. A is false but R is true.
e. Both A and R are false.

12. _____________ takes an integer value that corresponds to its position in the series starting from 0.
a. Positional index
b. Labelled index
c. Both
d. None of the above

13. Which of the following statement is wrong?
a. We can create Series from Dictionary in Python.
b. Keys of dictionary become index of the series.
c. Order of indexes created from Keys may not be in the same order as typed in dictionary.
d. All are correct.

14. What will be the output of the following?
a. 2
b. Mar
c. Feb
d. 3

15. Choose the correct output of the following code:
a. France Paris
France Paris
b. USA WashingtonDC
France Paris
c. France Paris
UK London
d. USA WashingtonDC
UK London

16. Which of the following statement will create an empty series named “S1”?
a. S1 = pd.Series(None)
b. S1 = pd.Series( )
c. Both of the above
d. None of the above