Data Visualisation with Matplotlib Class 12 PYQs 2024–2026 with Solutions | CBSE Informatics Practices Skip to content
Smart Notes for Every Exam · instant PDF download after payment +91 92520 37565
Class 12 · Informatics Practices · Chapter 4

Data Visualisation with Matplotlib: Class 12 PYQs 2024–2026 with solutions

All 5 CBSE board questions asked from Data Visualisation with Matplotlib in 3 board papers, with the year, set and marks of each. 5 are solved free below. The Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE) has every solution, all chapters and 3 full board papers.

Cover of Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE)
Class 12 Informatics Practices PYQ book: every chapter + 3 board papers, all solved
US$1.99US$1.9934% off
Free sample

Data Visualisation with Matplotlib: board weightage

Board weightage 2024–2026

Year202420252026
Questions122
Marks555

Most asked topics

Bar chart2
Line chart2
Histogram1

5 questions from 3 papers. Repeated questions are shown once with every year they were asked.

Jump to: 1 mark4 marks5 marks

1 mark: MCQ and Assertion–Reason

Q1 · CBSE 2026 · 90 · Q41 mark

In which scenario is a bar chart preferred over a line chart? (A) monthly temperature trends (B) comparing the number of students in different classes (C) stock price movements over time (D) website traffic over days

Solution

(B): comparing categories; the other options are trends over time (line charts).

Q2 · CBSE 2025 · 90 · Q71 mark

Which function of matplotlib is used to save a plot? (A) save() (B) saveplot() (C) export() (D) savefig()

Solution

(D) savefig().

4 marks: SQL / case-based

Q3 · CBSE 2026 · 90 · Q334 marks

Complete the histogram program for Ages = [22, 25, 24, 28, 30, 24, 29, 27, 21, 23], bins [20,22,24,26,28,30]: Statement-1 plot; Statement-2 alias for xlabel; Statement-3 legend; Statement-4 display.

Solution

import matplotlib.pyplot as plt
Ages = [22, 25, 24, 28, 30, 24, 29, 27, 21, 23]
binsize = [20, 22, 24, 26, 28, 30]
plt.hist(Ages, bins=binsize, edgecolor='black',
label='Participants') # Statement-1: hist
plt.xlabel('Age') # Statement-2: plt
plt.ylabel('Number of Participants')
plt.title("Age Distribution")
plt.legend() # Statement-3
plt.show() # Statement-4
(½ mark is deducted when () is missing after legend/show.)

Q4 · CBSE 2025 · 90 · Q334 marks

Complete the line-plot program (temperatures 30, 32, 31, 29, 28 over Day 1–Day 5): Statement-1 import; Statement-2 function; Statement-3 x-label; Statement-4 title.

Solution

import matplotlib.pyplot as plt          # Statement-1
days = ['Day 1','Day 2','Day 3','Day 4','Day 5']
temp = [30, 32, 31, 29, 28]
plt.plot(days, temp) # Statement-2
plt.xlabel('Days') # Statement-3
plt.ylabel('Temperature')
plt.title('Temperature over 5 days') # Statement-4
plt.show()

5 marks: programs and case studies

Q5 · CBSE 2024 · 90 · Q355 marks

(a) Fruits = ['Apple','Guava','Papaya','Grapes','Mango'], Price = [150, 70, 50, 30, 120]: generate a bar chart with title and axis labels, and save it as fruits.png.
OR (b) OR: draw the line chart "CO2 Emission" (April–August: 40, 50, 30, 60, 20 %) with title and axis labels, and save it as emission.png.

Solution

import matplotlib.pyplot as plt
Fruits = ['Apple','Guava','Papaya','Grapes','Mango']
Price = [150, 70, 50, 30, 120]
plt.bar(Fruits, Price)
plt.title("Fruits Prices")
plt.xlabel("Fruits")
plt.ylabel("Price")
plt.savefig("fruits.png")
plt.show()

OR
import matplotlib.pyplot as plt
month = ["April", "May", "June", "July", "August"]
percent = [40, 50, 30, 60, 20]
plt.plot(month, percent)
plt.title("Month wise CO2 emission")
plt.xlabel("Month")
plt.ylabel("Percentage")
plt.savefig("emission.png")
plt.show()

Get every solution for all chapters

  • Every board question of every chapter, each fully solved the way the board gives marks
  • 3 complete board papers, each followed by its solutions
  • Weightage and most-asked topics for every chapter
  • Instant PDF download, colour and black & white print copies
See real pages (free sample)

Revising the chapter first? Complete Informatics Practices Notes for Class 12 (CBSE 065, 2026-27) →

What you get in the pack

All chapters in this pack

  1. PYQ Ch 1 Pandas Series
  2. PYQ Ch 2 DataFrame: Creation and Attributes
  3. PYQ Ch 3 DataFrame Operations and CSV Files
  4. PYQ Ch 4 Data Visualisation with Matplotlib
  5. PYQ Ch 5 SQL Revision and Single-row Functions
  6. PYQ Ch 6 SQL Aggregates, Grouping and Joins
  7. PYQ Ch 7 Computer Networks
  8. PYQ Ch 8 Introduction to the Internet and Web
  9. PYQ Ch 9 Societal Impacts
  10. Board Paper 2026 Set 90 with Solutions
  11. Board Paper 2025 Set 90 with Solutions
  12. Board Paper 2024 Set 90 with Solutions
← PYQ Ch 3 DataFrame Operations and CSV Files PYQ Ch 5 SQL Revision and Single-row Functions →

Prices shown in US dollars. Show prices in: ₹ INR · US$ USD