Class 12 CS 083 Sample Pre-Board QP 2026 with Solution

class-12-cs-083-sample-pre-board-qp-2026-with-solution

Preparing for the Class 12 Computer Science (Code 083) board examination becomes much easier when students practice with high-quality Class 12 CS sample papers. To help learners score excellent marks, we have shared CBSE-pattern Sample Paper and Pre-Board Sample Paper along with complete, step-by-step solutions.

Why This Sample Paper Is Important for Class 12 CS Students?

Class 12 Computer Science sample paper with solutions helps students:

  • Understand the exact question paper format
  • Get familiar with important topics like Python, Data Handling, SQL, Computer Networks, Boolean Algebra, and Database Management
  • Improve speed and accuracy through real exam-type practice
  • Analyse mistakes using detailed solutions
  • Build confidence for school pre-boards and final board exams
  • Strengthen conceptual clarity with well-explained answers

Whether a student is preparing for pre-boards or revising for final boards, these solved papers act as a powerful revision tool.

CBSE Class 12 CS 083 Sample Pre-Board Question Paper 2026 with Solution

SAMPLE PRE-BOARD QUESTION PAPER – SET 1 (THEORY)
CLASS: XII SESSION: 2025-26
COMPUTER SCIENCE (083)

Time allowed: 3 Hours
Maximum Marks: 70

General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

1. State True or False:
chr() function returns the ASCII code of the character”.

Ans: False

2. Identify the output of the following code snippet:

M=['The', 'God', 'of', 'small', 'things']
print(M[3][2:]*len(M[1]))

a) ofofof
b) allallall
c) mallmallmall
d) smallsmall

3. What is the output of the given expression?
>>> -1<False or not 3 and 4

Ans: True

4. In SQL, which among the following is not DDL command?
a) ALTER
b) CREATE
c) UPDATE
d) DROP

5. What will be the output of the following Python code?

s="so many books so little time"
K=s.split('so')
print(K)


a) [”, ‘ many books ‘, ‘ little time’]
b) [‘ many books ‘, ‘ little time’]
c) [‘many books’, ‘little time’]
d) [‘many’, ‘books’, ‘little’, ‘time’]

6. Write the correct output of the following code:

i=2
while True>i:
	print(i)
	i=i-2
else:
	print("normal exit")

a) 2
b) 0
c) normal exit
d) False

7. What is the output of the given expression?
print(2//18%4**2+3)

a) 6
b) 12
c) 4
d) 3

8. Consider the given SQL query in MYSQL:
SELECT stream FROM student WHERE gender=”F”;
Sumit wants to display the stream name without any duplicate value. Write the corrected query.

Ans: SELECT DISTINCT stream FROM student WHERE gender=”F”;

9. What will be output of the following python code?

try:
	z=3+'a'
except ValueError:
	print("Value Error")
except TypeError:
	print("Type Error")

a) Value Error
b) Type Error
c) 3a
d) Index Error

10. What will be output of the following python code?
D={"Amit":85, "Ayesha":68, "Mayank":80, "Tara":90}
R=D.setdefault("Mayank", 70)
print(R)

a) ‘Mayank’
b) 70
c) 80
d) Error

11. What possible output(s) is/are expected to be displayed on the screen at the time of execution of the Python program from the following code?

import random
z=[3,8,7,9]
a=random.randint(1,2)
for i in range(a, len(z)):
	print(z[i], end='#')

a) 3#8#7#
b) 8#7#
c) 8#7#9#
d) 7#9#

random.randint(1,2) will generate either 1 or 2.
So two possible outputs are:
Case 1: If a = 1
Loop runs from index 1 to 3 (i.e., 1, 2, 3)
Values will be:
z[1] → 8
z[2] → 7
z[3] → 9
Output: 8#7#9#
Case 2: If a = 2
Loop runs from index 2 to 3 (i.e., 2, 3)
Values will be:
z[2] → 7
z[3] → 9
Output: 7#9#

12. What will be the output of the following code?

p=32
def display():
	global p
	p=p%5
	print(p, end='*')
display()
print(p) 

a) 32*2
b) 32*32
c) 2*32
d) 2*2

13. Fill in the blanks:
An attribute which establishes connection between two tables and it is primary key in another table is known as ______.

Ans: Foreign Key

14. What is the output of the given expression?
s="everything you can imagine is real"
Y=s.partition('in')
print(Y)

a) (‘everyth’, ‘in’, ‘g you can imagine is real’)
b) (‘everyth’, ‘in’, ‘g you can imag’, ‘in’, ‘e is real’)
c) [‘everyth’, ‘g you can imag’, ‘eis real’]
d) [‘everyth’, ‘in’, ‘g you can imagine is real’]

15. The degree and cardinality of a table named GAME are 4 and 6, respectively. The degree and cardinality of another table named SPORTS are 5 and 3, respectively. There is one common field in both tables. After performing the Cartesian product of both tables, what will be the new degree and cardinality of the resultant table?
a) 9 and 9
b) 20 and 9
c) 9 and 18
d) 20 and 18

16. Which SQL command is used to add a new attribute in a table in MySQL?
a) UPDATE
b) INSERT
c) ALTER
d) CREATE

17. Which of the following devices is essential to set up a wired LAN?
a) Modem
b) NIC
c) Repeater
d) Firewall

18. ______ is used for point-to-point communication or unicast communication such as radar and satellite.
a) Bluetooth
b) Infrared
c) Radio waves
d) Microwaves

19. Which network device serves as the entry and exit point of a network, as all data coming in or going out of a network must first pass through it?
a) Gateway
b) Modem
c) Switch
d) Repeater

Q.20 and Q.21 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): The Pandas library in Python is primarily used for creating static, animated and interactive 2D plots or figures.
Reason (R): Data visualization can be achieved with the help of a variety of charts and plots, including static plots, animations, and interactive visualizations.
Ans: b) Both A and R are true and R is not the correct explanation for A

21. Assertion (A): The SUBSTR() function extracts a portion of a string based on starting position and length.
Reason (R): The starting position in SUBSTR() begins from 0 in SQL.

Ans: d) A is False but R is True

SECTION B (7X2=14 Marks)

22. A. Write difference between = and == in Python. Give suitable example of each.

OR

Define dynamic data typing in python. Write an example to illustrate your answer.
Ans: It allows variables to hold values of different data types during the program execution.
Example:
x = 10 # x is an integer
x = “Hello” # Now x is a string

23. The code provided below is intended to calculate sum of odd numbers in a list. However, there are syntax and logical errors in the code. Rewrite the code in python after removing all error(s). Underline each correction done in the code.

def Sum-Odd():
	numbers = [13,8,15,20]
	total = 0
	for val in numbers():
		if val%2==0:
			total = total + val
			print(total)
Sum_Odd()
def Sum_Odd():
	numbers = [13,8,15,20]
	total = 0
	for val in numbers:
		if val%2!=0:
			total = total + val
	print(total)
Sum_Odd()

24. A. (Answer using Python built-in methods/functions only):
i) Write a statement to remove the key “age” from a dictionary named student.

Ans: student.pop("age")

ii) Write a statement to return the largest value from an integer list named nums.
Ans: max(nums)

OR

B. Predict the output of the following Python code:
msg="Buildathon Hackathon"
print(msg.replace("th", "j"))
print(msg.index("a"))

Ans: Buildajon Hackajon
5

25. A. Write a function remove_duplicates() in Python that accepts a list L and returns a new list containing only the unique elements from L, after removing the duplicates.

def remove_duplicates(L):
	new_list = []
	for ele in L:
		if ele not in new_list:
			new_list.append(ele)
	return new_list

OR

B. Write a Python function update_score() that accepts a dictionary named scores, a player name and a new score. If the player name already present in dictionary, update the score, otherwise, display the message “Player not found”.

def update_score(scores, playername, new_score):
	if playername in scores:
		scores[player] = new_score
	else:
		print("Player not found")

26. Predict the output of the Python code given below:

data={"Jan":4300,"Feb":2800,"Mar":5600,"Apr":4000}
high=[]
for month, sale in data.items():
	if sale > 4100:
		high.append(month)
print(sorted(high, reverse=True))

Ans: [‘Mar’, ‘Jan’]

27. A. Write suitable commands to do the following in MySQL.
i) To access /Enter in the database named Education

Ans: USE Education;

ii) Delete / remove a database named Tourism.
Ans: DROP DATABASE Tourism;

OR

B. Write difference between WHERE and HAVING clause with suitable example.

28. A. Define the following terms:
i) Bandwidth

Ans: Maximum amount of data that can be transmitted over a network communication channel in a given amount of time.

ii) Router
Ans: A router is a networking device that forwards data packets from one network to another. It determines the best possible path for data to travel using routing tables.

OR

B. i) Expand the following terms: VoIP and SMTP
Ans: VoIP: Voice over Internet Protocol
SMTP: Simple Mail Transfer Protocol

ii) Differentiate between Circuit Switching and Packet switching.
Ans: Circuit Switching: It requires point to point connections during calls with dedicated connection.
Packet Switching: Sends data in small blocks, called packets. It doesn’t require dedicated connection.

SECTION C (3X3=9 Marks)

29. Write a function CountDigits( ) in python which reads the content of a text file “KVSRESULT.TXT” and counts number of digits present in the text file.
Example:
If the contents in “MyData.TXT” are as follows:
“EM students will deliver a 100% pass result in AISSCE-2026.”
The output of the function should be:
No. of digits are: 7

def CountDigits( ):
	f=open("KVSRESULT.TXT","r")
	s=f.read( )
	count=0
	for ch in s:
		if ch.isdigit( ):
			count+=1
	print("No. of digits are: ", count)
	f.close( )

OR

Write a function Max_Vowels() in Python to display the line which has the maximum number of vowels from a text file, "NOVEL.TXT".

def Max_Vowels():
	f=open("Novel.txt", 'r')
	L=f.readlines()
	max_vowels = 0
	line_with_max = ""
	for line in L:
		count=0
		for ch in line.lower():
			if ch in 'aeiou':
				count+=1
		if count>max_vowels:
			max_vowels=count
			line_with_max=line
	print("Line with maximum vowels: ", line_with_max)
	f.close()
Max_Vowels()

30. Consider a dictionary named Books which contains name of books as key and price as value.
Write the following user defined functions in python and perform the specified operations on a stack named Book_Name.
i) Push_BName(): It checks price of the book from the dictionary Books and pushes name of such books which have price more than 350 rupees, into the stack, Book_Name.
ii) Pop_BName(): It deletes the name of books from stack Book_Name and displays them. The function should also display “Stack is Empty” message when there is no more book left in the stack.
For example:
If the dictionary Books contains the following data:
Books={“Physics”:550,“Maths”:300,“Chem”:480,“Hindi”:250,“CS”:360,“English” :310}
After execution of Push_BName(), the stack Book_Name should have:
[“Physics”,“Chem”,“CS”]
and on execution of Pop_BName(), the following output should be displayed:
CS
Chem
Physics
Stack is Empty

Book_Name=[ ]
def Push_BName(Books):
	for key in Books:
		if Books[key]>350:
			Book_Name.append(key)
	print("Stack is: ", Book_Name)

def Pop_BName( ):
	n=len(Book_Name)
	for i in range(n+1):
		if Book_Name==[]:
			print("Stack is Empty")
		else:
			print(Book_Name.pop())

31. A. Predict the output of the following code:

P=[1,9,4,6]
P.insert(2,3)
P.extend([8, 5])
print(P)
print(P.append([2,3]))
print(P[::2])

Ans: [1, 9, 3, 4, 6, 8, 5]
None
[1, 3, 6, 5]

OR

B. Write the output of the code given below:

s1="AI Vidyasetu 1.0"
s2=""
for i in range(len(s1)):
	if s1[i]>='0' and s1[i]<='9':
		Num=int(s1[i])
		Num+=1
		s2=s2+str(Num)
	elif s1[i]>='A' and s1[i]<='Z':
		s2=s2+s1[i-1].lower()
	elif s1[i]>='a' and s1[i]<='z':
		s2=s2+s1[i+1].upper()
	else:
		s2=s2+'@'
print(s2)

Ans: 0a@ DYASETU @2@1

SECTION D (4X4=16 Marks)

32. Consider a table VBB as given below: Table- VBB

School_CodeMentorGenderNo_of_teamsThemeSubmission_date
729AnujM2Atmanirbhar Bharat2025-10-23
888SudhirM1Vocal for local2025-11-07
988ManishM12Vocal for local2025-11-05
1007JatinderF3Samriddh Bharat2025-10-31
1100SangeetaF4Atmanirbhar Bharat2025-10-18
987NaveenM10Vocal for local2025-11-02
858MeenalF6Swadeshi2025-10-20
1011ZoyaF4Samriddh Bharat2025-11-03
1099SagarM8Swadeshi2025-10-28

A) Write the following queries:
i) Display name of theme and total teams registered under each theme.

Ans: SELECT Theme, sum(No_of_teams) FROM VBB GROUP BY Theme;

ii) Display School code, theme name and number of teams of those themes whose name starts with the alphabet letter ‘V’.
Ans: SELECT school_code, theme, no_of_teams FROM VBB WHERE theme like “V%”;

iii) Display school code, mentor name and theme of those teams whose submission date is NULL.
Ans: SELECT school_code, mentor, theme FROM VBB WHERE submission_date is NULL;

iv) Count the total number of teams registered by female mentors under the theme “Samriddh Bharat”.
Ans: SELECT sum(no_of_teams) FROM VBB WHERE gender=’F’ and theme=”Samriddh Bharat”;

OR

B) Write the output:
i) Select Mentor, No_of_teams from VBB Where submission_date< ‘2025-10-31’ order by No_of_teams;

ii) Select Gender, min(No_of_teams) from VBB group by Gender;

iii) Select Mentor, Theme, Submission_date from VBB where no_of_teams <>8 and Theme= “swadeshi”;

iv) Select DISTINCT Theme, submission_date from VBB where submission_date>= “2025-11-01”;

33. Ms. Mamta is a python programmer dealing with a furniture business. She has to develop a simple inventory management system of all furniture data of her business. She has created a csv file named furdata.csv, to store the details of furniture. The structure of furdata.csv is:
[F_ID, FNAME, FPRICE]

Ms. Mamta wants to write a Program in Python that defines and calls the following user defined functions:
i) add() – To accept and add data of a furniture to a CSV file ‘furdata.csv’.

def add():
	import csv
	f=open("furdata.csv","w",newline='')
	f_id=int(input("Enter Furniture Id :: "))
	fname=input("Enter Furniture name :: ")
	fprice=int(input("Enter price :: "))
	FD=[f_id,fname,fprice]
	w=csv.writer(f)
	w.writerow(FD)
	f.close( )
add()

ii) search() – To display the records of the furniture which has price more than 10000.

def search():
	import csv
	fin=open("furdata.csv","r")
	data=csv.reader(fin)
	found=0
	print("The Details are")
	for record in data:
		if int(record[2])>10000:
			found=1
			print(record)
	if found==0:
		print("Record not found")
	fin.close( )
search()

34. Assume that you are working for the Department of Agriculture (DOA). The DOA maintains data of various crops grown in different regions and the farmers who cultivate them. The data is stored in two tables – CROP and FARMER. Following are a few records from these two tables of AGRICULTURE database.

 Table: CROP
+---------+------------+---------+---------------+--------------+
| Crop_ID | Crop_Name  | Season  | Area_Hectares | Yield_Tonnes |
+---------+------------+---------+---------------+--------------+
|   101   | Wheat      | Rabi    |     250.50    |     400.00   |
|   102   | Rice       | Kharif  |     300.00    |     500.00   |
|   103   | Maize      | Kharif  |     180.00    |     250.00   |
|   104   | Barley     | Rabi    |     100.00    |     150.00   |
|   105   | Sugarcane  | Annual  |     350.00    |     600.00   |
+---------+------------+---------+---------------+--------------+
 Table: FARMER
+------------+--------------+---------+------------+---------+
| Farmer_ID  | Farmer_Name  | Village | Contact_No | Crop_ID |
+------------+--------------+---------+------------+---------+
|      1     | Ram Singh    | Rampur  | 9876543210 |   101   |
|      2     | Mohan Lal    | Sehore  | 9898989898 |   102   |
|      3     | Ramesh       | Rampur  |    NULL    |   103   |
|      4     | Sita Devi    | Bhopal  | 9012345678 |   101   |
|      5     | Gopal        | Indore  | 9023456789 |   104   |
|      6     | Kiran Patel  | Ujjain  | 9001234567 |   105   |
+------------+--------------+---------+------------+---------+
Note : The tables contain many more records than shown here.

As a Database Administrator of DOA, you are required to write SQL queries for the following:
i) Display farmer name and crop name which they cultivate in “Kharif” season.

SELECT farmer_name, crop_name FROM crop, farmer WHERE crop.crop_id=farmer.crop_id AND season="kharif";

ii) Display name of those crops which are cultivated by the farmers who live in Rampur village.

SELECT crop_name FROM crop, farmer WHERE crop.crop_id=farmer.crop_id AND village="rampur";

iii) Display the crop name and number of farmers cultivating it, but only for crops cultivated by more than one farmer.

SELECT crop.crop_name, count(farmer_id) FROM crop, farmer WHERE crop.crop_id=farmer.crop_id GROUP BY crop_name HAVING count(farmer_id)>1;

iv) A. To count total number of records, present in Farmer table.

SELECT count(*) FROM farmer;

OR

B. To delete the records of those farmers whose contact number is not known.

DELETE FROM farmer WHERE contact_no is null;

35. Sarika has created a table named FEES in the SCHOOLDB database in MySQL, which has the following structure:

FieldTypeDescription
Admn_NointAdmission Number
Snamevarchar(25)Student Name
ClassintClass of student
Amountfloat(6,2)Fee Amount
Statusvarchar(20)Paid / Unpaid

Write a user defined function UPDATE_FEES() in python to change the fee status to ‘PAID’ for all students whose fee amount is greater than or equal to 20000 using Python-MySQL database connectivity.
Assume the following for Python-Database connectivity:
host:
localhost, user: root, password: preboard

def UpdateFees():
	import mysql.connector as m
	con = m.connect(host="localhost", user="root", password="preboard",
	database="SCHOOLDB")
	cur = con.cursor()
	query = "UPDATE FEES SET Status='PAID' WHERE Amount >= 20000"
	cur.execute(query)
	con.commit()
	print(cur.rowcount, "record(s) updated successfully.")
	con.close()
UpdateFees()

SECTION E (2X5=10 Marks)

36. “KheloSports Pvt Ltd” is a sports management company that maintains a digital database of players in various sports. The company uses a binary file named “PLAYER.DAT” to store player information efficiently. The file contains records in the given format:
{player_id : [pname, age]}
Write the user-defined functions in pythons to perform the following actions:

i) Add_Data(): Take data of 5 players and write it into a binary file.

def Add_Data():
	import pickle
	f=open("PLAYER.DAT", "wb")
	L=[]
	for i in range(5):
		player_id=int(input("Enter player id: "))
		pname=input("Enter player name: ")
		age=int(input("Enter age: "))
		D={player_id : [pname, age]}
		L.append(D)
	pickle.dump(L,f)
	f.close()

ii) Delete_Record(): Remove the records of those players whose age is less than 18 years from the file “PLAYER.DAT”.

def Delete_Record():
	import pickle
	f=open("PLAYER.DAT", "rb+")
	L=pickle.load(f)
	M=[]
	found=0
	for record in L:
		for key in record:
			if record[key][1]<18:
				found=1
			else:
				M.append(record)
	if found==1:
		f.seek(0)
		pickle.dump(M,f)
		print("Records deleted successfully")
	else:
		print("Record not found")
	f.close()

37. “Tech Innovators” is planning to set up its India campus at Pune with its Head Office at Jaipur. The Pune campus has 4-main blocks-Innovation, Sales, Data Analytics and Admin. You as a network expert have to suggest the best network related solutions for their problems raised in (i) to (v).

class-12-cs-083-sample-pre-board-qp-2026-with-solution

Distance between various building blocks:

Innovation block to Sales block130 m
Innovation block to Data Analytics block95 m
Innovation block to Admin block60 m
Admin block to Data Analytics block50 m
Admin block to Sales block125 m
Pune campus to Head office1202 KM
Data Analytics to sales block55 m

Number of computers in each block:

Innovation block20
Sales block10
Data Analytics60
Admin25

i) Suggest the most appropriate location of the server inside the Pune campus (out of the 4 blocks), to get the best connectivity for maximum number of computers. Justify your answer.
Ans: In Data Analytics Block.
Justification: It has maximum number of computers and satisfies 80:20 rule of networking.

ii) Suggest network type (out of LAN, MAN, WAN) for connecting each of the following set of their offices:
a) Pune Campus and Head Office

Ans: WAN
b) Admin block and sales block

Ans: LAN

iii) Suggest the placement of the following devices at Pune Campus:
a) Switch

Ans: In all blocks

b) Repeater
Ans: Innovation block to Sales block and Admin block to Sales block

iv) Company wants to connect its local offices situated in Pune. Company can compromise with speed but cost of connectivity should be economic. Which of the following communication medium, you will suggest to be procured by the company:

  • Telephone cable
  • Twisted Pair Cable
  • Optical Fiber Cable

v) A. Which of the following will you suggest to establish the online face-to-face communication between the people in the Admin office of Pune Campus and Jaipur Head office?
a) Cable TV
b) E-mail
c) Video Conferencing
d) Text Chat

OR

B. Suggest and draw the cable layout to efficiently connect various blocks within the Pune campus for connecting the computers.

class-12-cs-083-sample-pre-board-qp-2026-with-solution-que-37

FAQs – Class 12 Computer Science (083) Sample Paper

  1. Is this sample paper based on the latest CBSE Class 12 syllabus?

Yes, the sample paper is fully updated as per the latest CBSE syllabus and exam pattern for the current academic session.

  1. Does this sample paper include solutions?

Absolutely. The PDF includes detailed, step-by-step solutions following the official CBSE marking scheme.

  1. Are Python programming questions covered?

Yes. The paper includes Python coding questions, output-based questions, logic-based programs, and file handling questions with solutions.

  1. Will this help in pre-board exam preparation?

Yes. This sample paper is ideal for pre-boards and helps students practice real-exam style questions.

  1. Does the sample paper include SQL and Database questions?

Yes, SQL queries, output-based questions, joins, and DBMS questions are included.

  1. Can students score 90+ by practicing these sample papers?

Practice makes a huge difference. With consistent practice, understanding solutions, and revising concepts, students can definitely aim for 90+ marks.

  1. Is it useful for last-minute revision?

Yes. The solved sample paper provides quick revision and helps students analyze important topics quickly.

Sharing is caring – pass it on!

Post Comment