On this page
The computer science practical file is often the last thing students finish: programs copied from a friend, outputs pasted without checking, and no idea what the examiner will ask. Yet the file and viva together are a third of the practical marks, and they reward work you can do at your own desk. This post covers how the marks are split, what a good file entry contains, a worked example, and how to prepare for the viva.
How are the 30 practical marks split?
The CBSE Computer Science curriculum for 2026-27 gives 30 practical marks in each class.
Class 11:
Lab test: one Python program, 12 marks, judged on 60% logic, 20% documentation and 20% code quality
Report file: at least 20 Python programs, 7 marks
Viva voce: 3 marks
Project using most of the concepts learnt: 8 marks
Class 12:
Lab test: a Python program for 8 marks (same 60/20/20 split) and 4 SQL queries on one or two tables for 4 marks
Report file: at least 15 Python programs, at least 5 sets of SQL queries and at least 4 Python-SQL connectivity programs, 7 marks
Project using concepts from Classes 11 and 12: 8 marks
Viva voce: 3 marks
The curriculum also gives a suggested practical list, such as pattern programs, series sums and string counts in Class 11, and text, binary and CSV file programs, a stack, and SQL commands in Class 12. Build your file around that list, and check the curriculum for your year.
What should each file entry contain?
The lab test marks documentation and code quality, not just whether the program runs, so write your file the same way. For each program:
Aim: one sentence saying what the program does.
Code: your own, with clear variable names and a comment on any step that is not obvious.
Test cases: at least three inputs, including an edge case, with the expected output written before you run it.
Output: the actual output from your computer.
One line on what you learnt or what went wrong while writing it.
The test cases are the part most files skip, and they are what the viva tests.
Worked example: prime or composite
This program is on the Class 11 suggested list. It uses only Class 11 ideas: input, a loop, a flag and `break`.
n = int(input("Enter a number: "))
if n < 2:
print(n, "is neither prime nor composite")
else:
is_prime = True
for d in range(2, int(n ** 0.5) + 1):
if n % d == 0:
is_prime = False
break
if is_prime:
print(n, "is prime")
else:
print(n, "is composite")Test cases written before running:
1 gives "neither prime nor composite" (the edge case)
2 gives "prime" (the loop `range(2, 2)` runs zero times, so the flag stays True)
9 gives "composite" (3 divides it)
25 gives "composite" (5 divides it, and 5 is exactly √25, which is why the + 1 matters)
97 gives "prime"
Viva questions you should expect on this program:
Why do you stop the loop at the square root of n? (If n = a × b with a ≤ b, then a ≤ √n, so any factor pair has one member at or below √n.)
Why is there a + 1 in the range? (A range stops before its end value, as the Python documentation on range defines it, so without the + 1, 25 would be reported as prime.)
What does `break` do here, and what happens if you remove it? (The answer is still correct, but the loop keeps running needlessly.)
Why is 1 treated separately?
Notice that every question is about why, not what. If you can answer these for each program in your file, you are ready.
Why does self-testing beat rereading the file?
Reading through your file the night before feels like revision, but research says testing yourself works better. Roediger and Karpicke (2006) had students either restudy prose passages or take recall tests on them. After five minutes, restudying did slightly better. After two days and after a week, the students who had tested themselves remembered substantially more, even though the restudy group felt more confident.
A second habit helps with the "why" questions. Chi and colleagues (1989) found that stronger students studying worked examples explained each step to themselves and linked it to principles, while weaker students did not. For code, that means saying out loud why each line is there. Our guide to the self-explanation technique shows how.
What about the project and honest use of AI tools?
The curriculum asks for a project that solves a real problem using file handling or Python-SQL connectivity, done in groups of two or three and started at least six months before the deadline. It also says students should be made aware of plagiarism and copyright. If you use an AI assistant while writing code, use it to explain errors or ideas, then write and test the code yourself; our post on AI and academic honesty sets out where help ends. The viva will quickly show whether you understand your own program.
A three-week plan before the practical exam
Week 1: List the programs in your file against the suggested list. Write any missing ones. Add test cases to every entry.
Week 2: Each day, pick five programs at random. Close the file, predict outputs for two inputs each, and write two "why" questions per program with answers.
Week 3: Do two timed mock lab tests: one new program in the time your school allows, written and documented as for the exam. In Class 12, add four SQL queries on a table you have not used before.
When you are stuck on why a program works, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. For the SQL sets in a Class 12 file, see our guide to SQL for CBSE.
Start today: take the last program in your file, write three test cases for it, and predict each output before running it.



