Back to Blog
CBSE 14 min read28 October 2026

CBSE Class 12 Computer Science — Expected Programs 2027

Most expected CBSE Class 12 Computer Science programs and questions for 2027: Python, file handling, stack, SQL and networking, with tested code and outputs.

In short: Nobody outside CBSE knows the exact 2027 Computer Science questions, so this list ranks question types by evidence: the unit marks (Python 40, Database 20, Networks 10), the section layout reported for the 37-question paper, and what teachers said about the March 25, 2026 paper. Programs are the most predictable part, so every code example below was run in Python 3.11 and every SQL query was run on SQLite, and the printed outputs are real. Treat this as a practice priority list, not a leak.

Last updated: October 28, 2026. The 2027 date sheet is not out yet. The section layout below is the one reported for the 37-question paper, and I could not open the 2026-27 sample paper itself.

CBSE Class 12 Computer Science 2027 — Quick Reference

ParameterDetails
Subject code083
Theory paper70 marks, 3 hours
Practical30 marks
Unit I: Computational Thinking and Programming40 marks
Unit II: Computer Networks10 marks
Unit III: Database Management20 marks
Questions in the 2026 paper37, in five sections A to E
2026 paper dateWednesday, March 25, 2026
Language for programsPython only

Sources: EdexLive and Kollege Apply for the unit marks. Times Now for the date and section notes. MSN for the 37 questions. The units add up: 40 + 10 + 20 = 70.

Section layout

A pre-board paper for 2025-26 that follows the CBSE pattern shows this split, and it matches Times Now's section notes below:

SectionQuestionsMarks eachTotal
A21 (MCQs, output tracing, assertion-reason)121
B7214
C339
D4416
E2510
Total3770

The split adds up to 37 questions and 70 marks. I took the counts from a school pre-board paper, not the official sample paper, so confirm them on the CBSE academic site.

What I could not verify

ItemStatus
The 2026-27 official sample paper layoutNot opened. Confirm the section counts above
Marks for each topic inside Unit INot confirmed. EdexLive gives only the three unit totals
Python-MySQL codeThe connector snippet below was not run, since it needs a MySQL server

What the 2026 Paper Showed

ObservationSource
Easy to moderate overall. Section A easy, B and C basic understanding, D easy, E (case study) needed logical thinkingTimes Now
Output-based and error-based programming questions were simple and manageable. Theory was directTimes Now (Silverline Prestige School teacher)
Section A mixed MCQs, output tracing and assertion-reason questionsTimes Now
Section B mixed debugging, output prediction, SQL commands and definitions, with balanced internal choicesTimes Now
Section C covered file handling, stack operations and code tracingTimes Now
Section D used real-world scenarios for SQL, CSV handling and Python-MySQL connectivityTimes Now
Section E had long answers on binary file handling and networkingTimes Now
Python questions were mostly direct but needed logic building and output tracing in places. SQL queries were simple and predictableTimes Now (Noida teacher)

Before the exam, a Ghaziabad teacher quoted by Times Now advised attempting Python questions first and writing neat, properly indented code. He listed SELECT, WHERE, aggregate functions and GROUP BY as the SQL basics, and a four-block office network case study as common.

Unit I: Python Programs (40 Marks)

Stack

#Expected questionEvidence
1Write functions to push, pop and display a stack implemented as a list2026 paper (stack operations in Section C)
stack = []

def push(item):
    stack.append(item)

def pop():
    if not stack:
        return "Underflow"
    return stack.pop()

def display():
    for i in range(len(stack) - 1, -1, -1):
        print(stack[i], end=" ")
    print()

push(10); push(20); push(30)
display()          # 30 20 10
print(pop())       # 30
display()          # 20 10

Run output: 30 20 10, then 30, then 20 10. After clearing the stack, pop() returns Underflow. A stack follows last in, first out, so display from the top.

Text file handling

#Expected questionEvidence
2Count lines starting with a given letter2026 paper (file handling in Section C)
3Count vowels and words in a text file2026 paper
count = 0
with open("story.txt", "r") as f:
    for line in f:
        if line[0] in "Aa":
            count += 1
print("Lines starting with A:", count)

with open("story.txt") as f:
    data = f.read()
vowels = sum(1 for ch in data if ch.lower() in "aeiou")
words = len(data.split())
print(vowels, words)

Test file used: "Apple is red", "Banana is yellow", "Ant is small", "Grapes are green" (four lines). Run output: 2 lines start with A, 19 vowels, 12 words.

Binary file handling (Section E topic in 2026)

#Expected questionEvidence
4Search a binary file for records that match a condition2026 paper (binary file handling in Section E)
5Update a record in a binary file2026 paper
import pickle

def search_by_salary(limit):
    found = 0
    with open("emp.dat", "rb") as f:
        try:
            while True:
                rec = pickle.load(f)
                if rec[2] > limit:
                    print(rec)
                    found += 1
        except EOFError:
            pass
    return found

Records stored as lists [id, name, salary]: [101, 'Asha', 52000], [102, 'Ravi', 41000], [103, 'Meena', 60000]. With a limit of 50000, the run printed [101, 'Asha', 52000] and [103, 'Meena', 60000] and returned 2.

For an update, read every record into a list, change the matching one, then rewrite the file in wb mode:

def raise_salary(eid, amt):
    recs = []
    with open("emp.dat", "rb") as f:
        try:
            while True:
                recs.append(pickle.load(f))
        except EOFError:
            pass
    for r in recs:
        if r[0] == eid:
            r[2] += amt
    with open("emp.dat", "wb") as f:
        for r in recs:
            pickle.dump(r, f)

Run output after raise_salary(102, 5000): record 102 shows 46000. Always say the file is opened with rb, wb or ab and that pickle is imported.

CSV handling (Section D topic in 2026)

#Expected questionEvidence
6Write rows to a CSV file and read them back with a condition2026 paper (CSV handling in Section D)
import csv

with open("marks.csv", "w", newline="") as f:
    w = csv.writer(f)
    w.writerow(["Roll", "Name", "Marks"])
    w.writerow([1, "Isha", 78])
    w.writerow([2, "Kabir", 91])
    w.writerow([3, "Tara", 84])

with open("marks.csv", "r", newline="") as f:
    r = csv.reader(f)
    next(r)                       # skip the header
    total = above = 0
    for row in r:
        total += 1
        if int(row[2]) > 80:
            above += 1
print(total, above)               # 3 2

Run output: 3 rows and 2 with marks above 80. Do not forget newline="" and the next(r) call that skips the header.

Output tracing and functions

#Expected questionEvidence
7Output of a function with default arguments2026 paper (output tracing, Section A and C)
8Output of a function that changes a list argument2026 paper
9Output of string slicing, list sorting and dictionary updates2026 paper
def calc(a, b=5, c=2):
    a = a + b
    b = b * c
    return a, b

print(calc(3))          # (8, 10)
print(calc(3, 4, 1))    # (7, 4)

def change(lst):
    lst.append(99)      # changes the caller's list
    lst = [1, 2]        # rebinds the local name only
    return lst

L = [5, 6]
print(change(L), L)     # [1, 2] [5, 6, 99]

s = "COMPUTER"
print(s[1:5], s[::-1], s[-3:])     # OMPU RETUPMOC TER
t = [3, 8, 1, 9]
t.sort(reverse=True)
print(t, t[1:3])                   # [9, 8, 3, 1] [8, 3]
d = {"a": 1, "b": 2}
d["c"] = d.get("c", 0) + 7
print(d)                           # {'a': 1, 'b': 2, 'c': 7}

The outputs shown are the real run outputs. The change example is a favourite: appending changes the list the caller passed in, but assigning a new list to the parameter does not.

Debugging questions

#Expected questionEvidence
10Find and correct errors in a short code fragment2026 paper (debugging in Section B)

Look for four classic slips: a missing colon, wrong indentation, = used where == is needed, and a wrong mode string when opening a file.

Practice CBSE Science on Padhaao

AI tutor with 10 learning modes · Quiz, Flashcards, Exam Practice & more · 3 free chapters daily

Start practicing Science

Unit III: Database Management (20 Marks)

SQL queries

All queries below ran on SQLite, and the syntax is the same in MySQL. The table was student(roll, name, class, marks) with rows Isha A 78, Kabir A 91, Tara B 84, Dev B 66, Mira B 72, Zoya C 95.

#Expected questionEvidence
11Group, aggregate and filter groupsTeachers named GROUP BY and aggregates (Times Now). SQL queries were predictable (2026)
12Filter with BETWEEN and sortSyllabus
13MAX, MIN and other aggregatesAggregates named by a Ghaziabad teacher
14Join two tablesJoins are in the syllabus
SELECT class, COUNT(*), AVG(marks) FROM student GROUP BY class;
-- A 2 84.5 | B 3 74.0 | C 1 95.0

SELECT class, AVG(marks) FROM student GROUP BY class HAVING COUNT(*) >= 2;
-- A 84.5 | B 74.0

SELECT name FROM student WHERE marks BETWEEN 70 AND 90 ORDER BY marks DESC;
-- Tara, Isha, Mira

SELECT MAX(marks), MIN(marks) FROM student;
-- 95 | 66

SELECT ename, dname FROM emp, dept WHERE emp.did = dept.did;
-- Anu Sales | Bhav IT | Chet IT

SELECT dname, COUNT(*) FROM emp NATURAL JOIN dept GROUP BY dname;
-- IT 2 | Sales 1

Write the clauses in order: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. WHERE filters rows and HAVING filters groups.

Python and MySQL connectivity

#Expected questionEvidence
15Connect Python to MySQL, run a query and print the rows2026 paper (Python-MySQL connectivity in Section D)
import mysql.connector as sql

con = sql.connect(host="localhost", user="root", passwd="yourpassword", database="school")
cur = con.cursor()
cur.execute("SELECT * FROM student WHERE marks > 80")
for row in cur.fetchall():
    print(row)
con.close()

I did not run this one because it needs a MySQL server. Use the steps in order: import, connect, create a cursor, execute, fetch, then close. Replace the password with your own, and never put a real password in shared code.

Unit II: Computer Networks (10 Marks)

#Expected questionEvidence
16A four-block office case study: place the server, choose the network type, and place hubs, switches or repeaters2026 paper (networking in Section E). Called common by a Ghaziabad teacher
17Types of networks (LAN, MAN, WAN) and their differencesTeacher-listed
18Network devices, protocols and topologies such as star and busTeacher-listed

Answer format

Part of the case studyWhat to write
Server placementPut the server in the block with the most computers, and say so, because it reduces traffic
Network typeChoose LAN for one campus, MAN for a city, WAN for cities or countries
RepeaterNeeded where the cable between two blocks is longer than the usual limit. Mark the distance the question gives
Hub or switchPlace one in each block. A switch is preferred, since it sends data only to the intended device
TopologyStar is easy to manage and one failed cable does not stop the rest. Bus is cheap but a break affects the network

Section-Wise Tips

SectionTip
A (21 x 1)Trace output on paper line by line. For assertion-reason, check each statement separately
B (7 x 2)Use the internal choice. Show the corrected line for a debugging question
C (3 x 3)Write the full function with the right file mode. Do not skip the with block's indentation
D (4 x 4)Read the scenario once and write the query clause by clause
E (2 x 5)Handle EOFError in binary-file loops. Draw the network layout in the case study

4-Week Practice Plan

WeekFocusQuestions in this list
Week 1Functions, output tracing, strings and lists7 to 10
Week 2Stack, text, binary and CSV files1 to 6. Write each program by hand
Week 3SQL and Python-MySQL11 to 15. Write twenty queries on one table
Week 4Networks and full papers16 to 18, then two full timed papers

This is a suggestion, not an official schedule. Our sample paper guide shows how to review a paper after solving it.

Frequently Asked Questions

Are these the exact questions in the 2027 Computer Science board exam?

No. Nobody outside CBSE knows the 2027 questions. This list ranks question types by evidence from the unit marks, the section layout and what teachers reported about the 2026 paper. Any page or channel that promises the actual paper is a scam.

How many marks does each unit carry?

Computational Thinking and Programming carries 40 marks, Database Management 20 and Computer Networks 10, making 70 for theory. Practical work carries 30.

What topics did the 2026 paper cover?

Teachers quoted by Times Now described output tracing, debugging and SQL commands in the short sections, file handling and stack operations in Section C, SQL scenarios with CSV handling and Python-MySQL connectivity in Section D, and binary file handling plus networking in Section E.

Was the 2026 Computer Science paper difficult?

Easy to moderate. Section A and D were easy, B and C needed basic understanding, and the Section E case study needed logical thinking. A Noida teacher said Python questions were mostly direct but needed logic building in places, and SQL queries were predictable.

Do I have to write programs in Python only?

Yes. The paper instructions in the pre-board paper I checked say all programming questions are to be answered using Python. Write neat, properly indented code. A Ghaziabad teacher quoted by Times Now advised careful attention to indentation and syntax to avoid common errors.

How do I prepare for the network case study?

Practise the four-block office layout: put the server in the largest block, name the network type, and place hubs, switches and repeaters with a reason. Draw the layout. A teacher quoted by Times Now called this scenario common.

Related Guides

Sources


Start Learning for Free →

₹21/mo (annual plan)

Padhaao covers every CBSE Science chapter

1,005 chapters across all subjects. 2.5 crore+ students. Pro from ₹21/month (annual plan).

See Pro Plans

Share this article

Practice CBSE Science chapters with AI

Every chapter from your syllabus. 10 learning modes. 3 free every day.

Start Science