CBSE Class 12 Computer Science Sample Paper 2026-27 with Solutions, Download PDF FREE

Last Updated: Nov 13, 2026, 10:00 IST

CBSE Class 12 Computer Science Sample Paper 2026-27 is available on the official website. Check the complete question paper pattern, section-wise marks distribution, important topics and marking scheme.

CBSE Class 12 Computer Science Sample Paper 2026-27
CBSE Class 12 Computer Science Sample Paper 2026-27

The Central Board of Secondary Education (CBSE) has prescribed the Class 12 Computer Science Sample Question Paper for the 2026-27 academic session to help students understand the structure and expected format of the upcoming board examination. The sample paper is an important preparation resource because it gives students an idea of how questions may be framed, how marks are distributed and which concepts they should practise before the examination.

Computer Science is offered under subject code 083 in Class 12. The whole Computer Science sample paper and the marking guidelines published by the CBSE Board are included in this article. Read the complete article for the latest update and get a free link to download Computer Science Marking Scheme PDF.

CBSE Class 12 Computer Science Sample Paper 2026-27

General Instructions:

1 This question paper contains 37 questions.

2 All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions

3 The paper is divided into 5 Sections- A, B, C, D and E.

4 Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.

5 Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.

6 Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.

7 Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.

8 Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.

9 All programming questions are to be answered using Python Language only.

10 In-case of MCQ, text of the correct answer should also be written.

SAMPLE QUESTION PAPER

Class XII Session 2026-27

COMPUTER SCIENCE (Code 083)


Section-A (21 x 1 = 21 Marks)


1 Write the output on execution of the following Python code: 1

L1=[10,20,25,30]

L1.insert(1,15)

print(L1) 

2 What will be the output of the following expression? 1

Msg = "programming is amazing"

print(Msg.split("m"))

a) ['progra', '', 'ing is a', 'azing']

b) ['progra', 'ming is a', 'azing']

c) ('progra', '', 'ing is amazing')

d) ['program', 'ing is a', 'zing']

3 Which of the following data types in Python is mutable? 1

a) Tuple

b) String

c) Integer

d) List

4 A column in one table matching a primary key of another table is called a: 1

a) Composite key

b) Candidate key

c) Foreign key

d) Super key

5 Consider the following Python code: t = (1, 2, 3) l = [4, 5] print(t + l) What will happen when this code is executed? 1

a) [1, 2, 3, 4, 5]

b) (1, 2, 3, 4, 5)

c) Error, because a tuple cannot be concatenated with a list

d) ((1, 2, 3), [4, 5])

6 What possible output is expected to be displayed on the screen at the time of execution of the Python program from the following code? 1

import random games = {0: "Chess",1: "Scrabble",2: "Sudoku",3: "Tic-Tac-Toe",4: "Puzzle" } start_key = random.randint(1, 2) end_key = random.randrange(3, 4) for k in range(start_key, end_key + 1): print(games[k], end="@@")

a) Sudoku@@Tic-Tac-Toe@@Puzzle@@

b) Scrabble@@Sudoku@@Tic-Tac-Toe@@

c) Chess@@Scrabble@@Tic-Tac-Toe@@

d) Scrabble@@Tic-Tac-Toe@@

7 Predict the output for the following: Dl={"Pen":12, "Pencil":6, "Scale":5, "InkPen":20} print(12 in Dl) 1

a) False

b) Error

c) None

d) True

8 Long-distance communication without line-of-sight is mainly achieved using: 1

a) Microwaves

b) Ultraviolet

c) Radio waves

d) X-rays

 9 Which MySQL query will display all employees whose salaries are between 90,000 and 100,000 (including limits)? 1

a) SELECT * FROM Employees WHERE salary > 90000 AND salary < 100000;

b) SELECT * FROM Employees WHERE salary IN (90000, 100000);

c) SELECT * FROM Employees WHERE salary BETWEEN 90000 AND 100000;

d) SELECT * FROM Employees WHERE salary = 90000 OR salary = 100000;

10 What will be the output of the following Python statement: print(25+100**1**3/5). 1

11 What is the data type of the result when the expression 5 // 2 is evaluated in Python? 1

a) float

b) int

c) string

d) None

12 Every network interface card (NIC) comes with its own ________ address. 1

a) Internet Protocol (IP)

b) Open Systems Interconnection (OSI)

c) Physical (MAC)

d) Dynamic Host Configuration Protocol (DHCP)

13 In a student table, “Class” can only take values from {IX, X, XI, XII}. This set is called the ________. 1

a) Domain

b) Tuple

c) Attribute

d) Key

14 What would be written in the file errorlog.txt after the following code is run? def data(num): try: return 190/(29-num) except ZeroDivisionError: logfile = open ("errorlog.txt", "w") logfile.write ("Num was 29") logfile.close() data(29). 1

15 Which of the following will NOT change if you insert a new record into a table? 1

a) Cardinality

b) Degree

c) Number of tuples

d) Total rows

16 What will be the output of the following Python code? y = 8 def update(): y = y + 2 print(y) update(). 1

a) 10

b) 8

c) Error

d) None

17 In ________ switching, before a communication starts, a dedicated path is identified between the sender and the receiver. 1

a) Graph

b) Plot

c) Circuit

d) Packet

18 What will be the output of the following Python code? text = "Drone Expo" print(text[-2: :-4]). 1

19 Which MySQL command correctly removes an attribute Age from table Student? 1

a) ALTER TABLE Student DROP COLUMN Age;

b) ALTER TABLE Student REMOVE Age;

c) DROP COLUMN Age FROM Student;

d) DELETE COLUMN Age FROM Student

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as:

a) Both A and R are True and R is the correct explanation for A.

b) Both A and R are True and R is not the correct explanation for A.

c) A is True but R is False.

d) A is False but R is True.

20 Assertion (A): Opening a file in mode rb allows you to read a binary file without modifying it. 1

Reason (R): In rb mode, if the file does not exist, Python creates a new empty file.

21 Assertion (A): The MySQL query SELECT Student_Name FROM Student WHERE Guardian_Phone IS NULL; displays the names of students whose guardian phone number is not recorded. 1

Reason (R): In MySQL, you can also use = to check for NULL values; it is equivalent to IS NULL to identify columns with no value.

 

Section-B ( 7 x 2=14 Marks)

22 A. Define global variable and local variable with a suitable example. 2

OR

B. Write the difference between the seek() and tell() methods in Python text file handling with a suitable example. 2

23 The Python program below tries to print the list in reverse. However, there are syntax and logical errors in the code. Rewrite it after removing all the errors. Also, underline all the corrections made words=["Class Test","Term Exams","Pre-board Exam","Board Exam’] L=len(words) for i in range(L, -1, -1) Print (words[i] , end = " ") 2

24 A. Write a Python function capitalize_words(words) that takes a list of strings words and returns a new list with each word capitalize. Example: If the input is ["python", "computer", "science"] The output should be ["Python", "Computer", "Science"]. 2

OR

B. Write a Python function sum_positive(list1) that takes a list of numbers and prints the sum of all positive numbers in the list. Example: If the input is [10, -5, 20, -3, 7] The output should be 37. 2

25 A. (Answer using Python built-in methods/functions only): 2

I. Write a statement to check whether the string username starts with "admin".

II. Given data = [2, 7, 9, 9, 2], write a statement to count how many times the largest element occurs.

OR

B. Predict the output of the following Python code: text = "Python Programming" print(text.replace("o", "0")) print(text.find("z")) 2

26 Predict the output of the following Python code: code = "gLaD5" result = [] i = 0 while i < len(code): if code[i].isupper(): result.append(code[i].lower()) 2

elif code[i].isdigit(): result.append(int(code[i]) * 2) else: result.append("#") i += 1 print(result)

27 A. Write suitable commands to do the following in MySQL. 2

I. Display a list of all the relations stored in a database.

II. Delete a database named CS_SP.

OR

B. Differentiate between alter and update command in MySQL with a suitable example. 2

28 A. Which protocol helps us to browse through web pages using internet browsers? Name any one internet browser. 2

OR

B. Define tree topology. Also, write down any one limitation of tree topology. 2

 

Section-C ( 3 x 3 = 9 Marks)


29 A. Write and call a Python function to read "History.txt" and display all lines that contain a four-digit year (e.g., 1999, 2024 etc.)

OR

B. Write a Python function that displays the number of times the word "Python" appears in a text file named "Prog.txt". 3

30 A list containing records of books is given as: B = [("Machine Learning Basics", 550), ("World Geography", 450), ("Wonder World", 140), ("AI Revolution", 750)] Write the following user-defined functions to perform operations on a stack named Books: 3

I. Push_element(): Push only those books whose price is more than 250 into the stack.

II. Pop_element(): Pop the items from the stack and display them. After all items are popped, display "Stack Empty". Expected Output: ('AI Revolution', 750) ('World Geography', 450) ('Machine Learning Basics', 550) Stack Empty. 

31 A. Write a Python function avg_len( ) segment that adds up the lengths of all the words in a list and then prints the average (mean) length. 3

OR

B. Consider the tuple pairs = ((2,5),(4,2),(9,8),(12,10)). Write a Python function cnt_even( ) to count the number of pairs (a, b) where both a and b are even. 3

 

Section-D ( 4 x 4 = 16 Marks)


A. Write the following queries:

I. To display the number of participants in each event where the number of participants is greater than 1.

II. To display the distinct event names available in the Tech Event.

III. To display details of participants whose names contain the letters ‘an’.

IV. To display all records of TECH_EVENT_REG sorted by participant_name in descending order.

OR

B. Predict the output of the following:

I. Select participant_name, event_name from tech_event_reg where grade = 11;

II. Select event_name, count(*) from tech_event_reg group by event_name;

III. Select participant_name from tech_event_reg where event_name like '%challenge';

IV. Select max(reg_fee) from tech_event_reg where grade in (9, 10);

33 Kabir runs a vehicle rental agency and maintains a CSV file named Rentals.csv. The file stores daily rental details with columns: Vehicle_ID, Vehicle_Type, Hours_Rented, Rate_Per_Hour Create the following user-defined functions: 4

I. AddRental() – to accept rental details from the user and append them to Rentals.csv.

II. CalculateTotalRent() – to calculate and return the total rent earned (Hours_Rented × Rate_Per_Hour).

I. Write a MySQL query to update the venue of the event "Inter-School Chess Championship" to "Multi-Purpose Hall".

II. Display the details of all chess events scheduled after 2025-01-01.

III. Write a MySQL query to display the registration details of students who have registered for events scheduled in ‘Auditorium Hall’, ‘Activity Room 3’, or ‘Library Conference Area’.

IV. a. Display the student_name along with the event_name for all registrations

or

b. Write a MySQL query to display the cartesian product of Chess_Event and Registrations tables.

35 MySQL database named LibraryDB has a table book_records which contains the following attributes: 4

• Book_ID: ID of the book (Integer)

• Book_Title: Title of the book (String)

• Author: Author of the book (String)

• Copies: Number of copies available (Integer) Consider the following details to establish Python-MySQL connectivity:

• Username: librarian

• Password: lib@2025

• Host: localhost Write a Python-MySQL program to change the Book_Title to 'Data Structures in Python' for the record whose Book_ID is 109 in the book_records table.

 

 

Section-E (2 X 5 = 10 Marks)


36 A college administrator, Atul, maintains student course enrollment records. Each record includes Roll_No, Student_Name, Course, Fees. Write Python functions to:

I. Input enrollment details and append them to a binary file.

II. Update the Fees of all students enrolled in the "Data Science" course to 75000. 2+3

37 AKA University is setting up its Academic blocks at Raipur and planning to set up a network. The university has 3 academic blocks and one Human Resource Center as shown in the diagram below:

Center to center distances between various blocks is as follows:


 

I. Suggest the most suitable place (i.e. Block/Center) to install the server of this university with a suitable reason.

II. Identify and draw the most suitable topology for connecting all the blocks if the university wants a centralized network management system.

III. Suggest and placement of the following devices with reasons.

a. Repeater

b. Switch

IV. The Institute is planning to link its study center situated in Delhi. Suggest a way to connect it with reasonably high speed guided medium.

V. A. The Vice-Chancellor wants to hold a face-to-face digital meeting with the Heads of Departments in all blocks simultaneously. Which Protocol will be used?

OR

B. What is the use of VoIP?


CBSE Class 12 Computer Science Marking Scheme 2026-27

Since students are now receiving a sample paper, we are also giving them the marking guidelines and the solutions. The marking scheme and answers are available for students to view after completing the example papers. 

CHECK: CBSE Class 12 Computer Science Marking Scheme 2026-27

 

Also read:

CBSE Class 12 Chemistry Sample Paper 2027 with Solutions: Download Model Paper PDF FREE

CBSE Class 12 Biology Sample Paper 2027 with Solutions, Download Model Paper PDF FREE

Anjali is an education journalist with over a year of experience in digital and business journalism. She has previously worked with BW Businessworld and ANI, where she gained experience in news writing, editing, research, and fact-checking. At Jagran Josh, she writes education news and covers competitive exams and current affairs, with a keen interest in delivering accurate, informative, and reader-focused content. She holds a BA from Miranda House, University of Delhi, and a postgraduate diploma in English Journalism from the Indian Institute of Mass Communication (IIMC). Anjali enjoys reading and exploring new ideas and perspectives through books.

... Read More
First Published: Nov 13, 2026, 10:00 IST

Get here latest School, CBSE and Govt Jobs notification and articles in English and Hindi for Sarkari Naukari, Sarkari Result and Exam Preparation. Empower your learning journey with Jagran Josh App - Your trusted guide for exams, career, and knowledge! Download Now

Trending

Latest Education News