Class 12 Computer Science Most Expected Questions for CBSE 2026-27 (with Answers)

Computer Science is a scoring subject if you practise the right question types. Nobody can say for sure which questions will come, but CBSE repeats the same kinds of questions every year. This post lists the Class 12 Computer Science most expected questions for 2026-27, with answers you can check yourself.

Exam pattern at a glance

  • Subject code: 083
  • Total marks: 100, with 70 for theory and 30 for practical
  • Three theory units:
UnitMarks
Computational Thinking and Programming – 2 (Python, file handling, stack)30
Computer Networks15
Database Management (SQL and Python–SQL connectivity)25

The biggest unit is Python, so spend most of your time there. SQL is the easiest to score in, because the questions are predictable.

Unit 1: Python (functions, files and stack)

Q1. Output-based question. What is the output?

python

def f(a, b=2):
    return a * b

print(f(3), f(3, 4))

Answer: 6 12. The default value of b is used only when you don’t pass a second value.

Q2. List slicing. What is the output?

python

lst = [1, 2, 3]
lst.append(4)
print(lst[::-1])

Answer: [4, 3, 2, 1]. The slice [::-1] reverses the list.

Q3. Text file. Write a function that counts how many times the word “the” appears in the file story.txt.

python

def count_the():
    count = 0
    with open("story.txt", "r") as f:
        for word in f.read().split():
            if word.lower() == "the":
                count += 1
    return count

Q4. Stack. Write functions to push, pop and peek on a stack that uses a list.

python

stack = []

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

def pop():
    if len(stack) == 0:
        return "Stack is empty"
    return stack.pop()

def peek():
    if len(stack) == 0:
        return "Stack is empty"
    return stack[-1]

A stack follows LIFO (last in, first out). Write this one-line definition in the exam to earn the theory mark.

Unit 2: Computer Networks

Q5. Write one difference between a hub and a switch.
Answer: A hub sends the data it receives to every connected device. A switch sends it only to the device it is meant for, so it is faster and more secure.

Q6. Write the full forms of URL, HTTP, VoIP and LAN.
Answer: Uniform Resource Locator, HyperText Transfer Protocol, Voice over Internet Protocol, Local Area Network.

Q7. Which device connects two different networks, such as your home network and the internet?
Answer: A router.

Networks questions are mostly one-mark and two-mark definitions. Learn topologies (star, bus, tree), protocols and the main devices.

Unit 3: Database management and SQL

Use this table, STUDENT, for the questions below.

RollNoNameClassMarks
1Aman12A88
2Simran12A92
3Rohan12B75
4Priya12B81

Q8. Display all students with more than 80 marks, highest first.

sql

SELECT * FROM STUDENT WHERE Marks > 80 ORDER BY Marks DESC;

Q9. Display the average marks of each class.

sql

SELECT Class, AVG(Marks) FROM STUDENT GROUP BY Class;

Output: 12A → 90, 12B → 78.

Q10. Write a Python program that connects to MySQL and displays all students with more than 80 marks.

python

import mysql.connector

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

In the exam, remember the five steps: connect, create a cursor, execute the query, fetch the results and close the connection.

Questions that come again and again

  • Output of a short Python function or list/string program
  • File handling: read a text file, count words or lines, or work with a binary file
  • Stack operations (push, pop, display)
  • SQL: WHERE, ORDER BY, GROUP BY, HAVING, aggregate functions and joins
  • Python–MySQL connectivity
  • Network devices, topologies and protocols
  • Case-study questions that mix Python and SQL

How to prepare

  1. Type your code and run it. Don’t only read it. Write each program above on a computer.
  2. Learn the SQL clauses in order: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY.
  3. Practise the 30 practical marks too, with a neat file, working programs and clear answers in the viva.
  4. Solve the official sample paper within 3 hours.

You can find notes on our Study Material page, and if you are stuck, contact us with your chapter and doubt. New to Python? Start with our Python for beginners guide.

Frequently asked questions

How many marks is the Class 12 Computer Science theory paper?
70 marks. The practical carries another 30.

Are these questions sure to come in the exam?
No. These are the question types that appear most often. If you can solve them, you can solve similar questions too.

Which unit should I study first?
Start with Python and SQL. Together they carry most of the marks.

Team KKETA: Learn · Understand · Excel

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top