The practical component of Class 11 Informatic Practices is where theoretical concepts come alive. In the laboratory, a student writes Python programs, executes SQL queries, and builds data visualisations, demonstrating that they can actually apply what they have learned. The practical exam typically consists of writing programs, running them, answering questions based on the output, and completing a project.
A good practical student is systematic: they read the problem carefully, plan the solution, write clean and readable code, test it with sample inputs, and handle errors gracefully. The most common sources of lost marks in practicals are careless syntax errors, wrong indentation, missing imports, and an inability to predict output or trace errors. This chapter consolidates everything learned in the previous chapters into a practical, exam-ready skill set.
We will work through complete example programs for common practical problems, study error handling with try and except, learn debugging techniques, and review the typical structure of a practical file. We will also list the standard programs and SQL queries a student is expected to practise before the examination. This chapter is the bridge between knowing concepts and demonstrating skill.
Most practical Python programs follow the same structure:
input() and convert types if needed.print().def find_average(marks):
total = sum(marks)
count = len(marks)
return total / count
marks_list = []
n = int(input("Enter number of students: "))
for i in range(n):
m = int(input("Enter marks: "))
marks_list.append(m)
avg = find_average(marks_list)
print("Average marks:", avg)
Real programs receive unexpected input. Python raises exceptions, and the try and except block prevents the program from crashing:
try:
num = int(input("Enter a number: "))
print("You entered", num)
except ValueError:
print("That was not a valid number")
The try block contains the risky code; if a ValueError occurs, control jumps to the matching except block. The else block runs if no error occurred, and finally runs always.
try:
a = int(input("a: "))
b = int(input("b: "))
result = a / b
except ZeroDivisionError:
print("Cannot divide by zero")
except ValueError:
print("Invalid number entered")
else:
print("Result:", result)
finally:
print("Program finished")
int("abc").print() statements temporarily to inspect variable values.A typical visualisation practical provides data and asks for a chart. The recipe is always the same:
import matplotlib.pyplot as plt
subjects = ["Maths", "Science", "English", "IP"]
marks = [85, 78, 92, 88]
plt.bar(subjects, marks, color="blue")
plt.title("Marks in Subjects")
plt.xlabel("Subjects")
plt.ylabel("Marks")
plt.show()
The examiner may ask for a line chart for trends, a bar chart for comparison, or a pie chart for proportions. Remember to include the import statement, all labels, and plt.show().
For MySQL practicals, the flow is: connect, create database, create table, insert sample data, and then answer queries.
CREATE DATABASE school;
USE school;
CREATE TABLE student (
roll INT PRIMARY KEY,
name VARCHAR(30),
marks DECIMAL(5,2),
city VARCHAR(20)
);
INSERT INTO student VALUES (1, 'Aarav', 89, 'Delhi');
INSERT INTO student VALUES (2, 'Bina', 94, 'Mumbai');
SELECT name, marks FROM student WHERE marks > 85 ORDER BY marks DESC;
The examiner may ask for specific queries such as counting records, finding maximum marks, filtering by city, or grouping by city with an aggregate.
A good practical file contains for every program: 1. Aim and objective. 2. Algorithm or steps. 3. Source code with proper comments. 4. Sample input and output. 5. Conclusion.
Following a consistent format impresses examiners and makes the file easy to evaluate. At the end, include the project work and the SQL query sheets.
The prime-checking program is a favourite practical question. The idea is to test whether a number has any divisor other than 1 and itself. A loop runs from 2 up to half of the number, and if the number is exactly divisible by any value in that range, a flag is set to show that the number is not prime. The program must handle the special cases 0 and 1 first, since neither is prime. Writing the condition for the loop and updating the flag correctly are the two steps where students lose marks, so the logic deserves careful attention and a few sample tests before it is recorded in the practical file.
The word-frequency program combines dictionaries with string handling. The sentence is read with input(), converted to lower case, split into words using the split() method, and then each word is counted with a dictionary exactly as described in the dictionary chapter. This program is a favourite because it ties together several chapters at once: strings, lists, dictionaries, and loops. It demonstrates how the separate topics of the syllabus come together in a single, meaningful solution. Tracing such a program with a short sentence like "a cat and a dog" is an excellent way to prepare for output-prediction questions, since the examiner often gives a small input and asks what the program will print. By working through such programs completely before the examination, the student builds the confidence and speed that the practical test demands.
| Exception | When It Occurs | Example |
|---|---|---|
| SyntaxError | Wrong syntax | Missing colon |
| NameError | Undefined variable | print(x) without x |
| TypeError | Incompatible types | "a" + 5 |
| ValueError | Invalid value | int("abc") |
| IndexError | Index out of range | lst[10] on short list |
| KeyError | Missing dictionary key | d["x"] |
| ZeroDivisionError | Divide by zero | 5 / 0 |
| Task | Key Steps |
|---|---|
| Python program | Input, process, output with print() |
| Error handling | try, except, else, finally |
| Visualisation | Import plt, choose chart, labels, show() |
| MySQL | CREATE, INSERT, SELECT with WHERE/ORDER BY |
| Practical file | Aim, algorithm, code, input/output, conclusion |
input() results to int() or float(), causing type errors.try without except, which is a syntax error.ZeroDivisionError, crashing the program.plt.show(), so the chart never appears.Practicals are where a student proves mastery of Python, matplotlib, and MySQL. The key to success is a systematic approach: understand the problem, plan the solution, write clean code, test thoroughly, and record the output properly. Error handling with try and except makes programs robust, and debugging skills turn failures into learning. The standard recipes for programs, charts, and SQL queries, once internalised, make any practical task manageable. By combining all the concepts from earlier chapters into complete working examples, this chapter prepares the student not only for the practical examination but also for confident problem solving in the real world.