CBSE Class 12 Computer Science Sample Paper 2023 Set A

Read and download the CBSE Class 12 Computer Science Sample Paper 2023 Set A, designed by expert teachers according to the latest 2025-26 curriculum and examination pattern issued by CBSE, NCERT, and KVS. These Class 12 Computer Science sample papers include detailed step-by-step solutions, helping students to practice and evaluate their performance against the most recent marking schemes.

Solved Sample Paper for Class 12 Computer Science PDF

Our Class 12 Computer Science model papers are important for understanding the weightage of different chapters and the difficulty level of expected questions. By solving these guess papers Class 12 students can identify weak areas and improve time management. We also suggest referring to our Class 12 Computer Science Question Papers of previous years to further strengthen your exam preparation.

Class 12 Computer Science Sample Paper with Solutions

SECTION A

1. State True or False
“Variable declaration is implicit in Python.”
Answer: TRUE

2. Which of the following is an invalid datatype in Python?
(a) Set
(b) None
(c) Integer
(d) Real
Answer: D

3. Given the following dictionaries
dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}
Which statement will merge the contents of both dictionaries?
(a) dict_exam.update(dict_result)
(b) dict_exam + dict_result
(c) dict_exam.add(dict_result)
(d) dict_exam.merge(dict_result)
Answer: A

4. Consider the given expression:
not True and False or True
Which of the following will be correct output if the given expression is evaluated?
(a) True
(b) False
(c) NONE
(d) NULL
Answer: A

5. Select the correct output of the code:
a = "Year 2022 at All the best"
a = a.split('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)
(a) Year . 0. at All the best
(b) Year 0. at All the best
(c) Year . 022. at All the best
(d) Year . 0. at all the best
Answer: A

6. Which of the following mode in file opening statement results or generates an error if the file does not exist?
(a) a+
(b) r+
(c) w+
(d) None of the above
Answer: B

7. Fill in the blank:
______ command is used to remove primary key from the table in SQL.
(a) update
(b) remove
(c) alter
(d) drop
Answer: C

8. Which of the following commands will delete the table from MYSQL database?
(a) DELETE TABLE
(b) DROP TABLE
(c) REMOVE TABLE
(d) ALTER TABLE
Answer: B

9. Which of the following statement(s) would give an error after executing the following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5
Answer: B

10. Fill in the blank:
_________ is a non-key attribute, whose values are derived from the primary key of some other table.
(a) Primary Key
(b) Foreign Key
(c) Candidate Key
(d) Alternate Key
Answer: B

11. The correct syntax of seek() is:
(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)
Answer: A

12. Fill in the blank:
The SELECT statement when combined with __________ clause, returns records without repetition.
(a) DESCRIBE
(b) UNIQUE
(c) DISTINCT
(d) NULL
Answer: C

13. Fill in the blank:
______is a communication methodology designed to deliver both voice and multimedia communications over Internet protocol.
(a) VoIP
(b) SMTP
(c) PPP
(d) HTTP
Answer: A

14. What will the following expression be evaluated to in Python?
print(15.0 / 4 + (8 + 3.0))
(a) 14.75
(b) 14.0
(c) 15
(d) 15.5
Answer: A

15. Which function is used to display the total number of records from table in a database?
(a) sum(*)
(b) total(*)
(c) count(*)
(d) return(*)
Answer: C

16. To establish a connection between Python and SQL database, connect() is used. Which of the following arguments may not necessarily be given while calling connect() ?
(a) host
(b) database
(c) user
(d) password
Answer: B

Q17 and 18 are ASSERTION AND REASONING 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 

17. Assertion (A):- If the arguments in function call statement match the number and order of arguments as defined in the function definition, such arguments are called positional arguments.
Reasoning (R):- During a function call, the argument list first contains default argument(s) followed by positional argument(s).
Answer: C

18. Assertion (A): CSV (Comma Separated Values) is a file format for data storage which looks like a text file.
Reason (R): The information is organized with one record on each line and each field is separated by comma.
Answer: A

SECTION B

19. Rao has written a code to input a number and check whether it is prime or not. His code is having errors. Rewrite the correct code and underline the corrections made.
def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)
Answer: def prime():
n=int(input("Enter number to check :: ")) #bracket missing
for i in range (2, n//2):
if n%i==0: # = missing
print("Number is not prime \n")
break #wrong indent
else:
print("Number is prime \n”) # quote mismatch

20. Write two points of difference between Circuit Switching and Packet Switching.
Answer: 

Circuit SwitchingPacket Switching
Circuit switching is the method
of switching which is used for
establishing a dedicated
communication path between
the sender and the receiver.
Packet switching is the method
of switching where no dedicated
path is established from the
source to the destination.
Data is processed and
transmitted at the source only.
Data is processed and
transmitted, not only at the
source but at each switching
station.
It is more reliable.It is less reliable.

OR

Write two points of difference between XML and HTML.
Answer: XML (Extensible MarkupLangauge)
♦ XML tags are not predefined, they are user defined
♦ XML stores and transfers data.
♦ Dynamic in nature
HTML (Hypertext Markup Langauge)
♦ HTML tags are pre-defined and it is a markup language
♦ HTML is about displaying data.
♦ Static in nature

21. (a) Given is a Python string declaration:
myexam="@@CBSE Examination 2022@@"
Write the output of: print(myexam[::-2])
(b) Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
Answer: (a) @20 otnmx SC@
(b) dict_items([('name', 'Aman'), ('age', 27), ('address', 'Delhi')])

22. Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example to support your answer.
Answer: A foreign key is used to set or represent a relationship between two relations (or tables) in a database. Its value is derived from the primary key attribute of another relation.
For example:
In the tables TRAINER and COURSE given below, TID is primary key in TRAINER
table but foreign key in COURSE table. 
TRAINER
cbse-class-12-computer-science-sample-paper-2023-set-a
cbse-class-12-computer-science-sample-paper-2023-set-a

23.
(a) Write the full forms of the following:
(i) SMTP (ii) PPP
(b) What is the use of TELNET?
Answer: (a) (i) SMTP: Simple Mail Transfer Protocol
(ii) PPP: Point to Point Protocol
(b) TELNET is used to access a remote computer / network.

24. Predict the output of the Python code given below:
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
Answer: 22 # 40 # 9 # 13 #

OR

Predict the output of the Python code given below:
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
Answer: (22,44,66)

25. Differentiate between count() and count(*) functions in SQL with appropriate example.
Answer: COUNT(*) returns the count of all rows in the table, whereas COUNT () is used with Column_Name passed as argument and counts the number of non-NULL values in a column that is given as argument. Example: Table : EMPL
cbse-class-12-computer-science-sample-paper-2023-set-a

OR

Categorize the following commands as DDL or DML:
INSERT, UPDATE, ALTER, DROP
Answer: DDL- ALTER, DROP
DML – INSERT, UPDATE

SECTION C

26. (a) Consider the following tables – Bank_Account and Branch:
Table: Bank_Account  
cbse-class-12-computer-science-sample-paper-2023-set-a
cbse-class-12-computer-science-sample-paper-2023-set-a
What will be the output of the following statement?
SELECT * FROM Bank_Account NATURAL JOIN Branch;
(b) Write the output of the queries (i) to (iv) based on the table,
TECH_COURSE given below:
cbse-class-12-computer-science-sample-paper-2023-set-a
(i) SELECT DISTINCT TID FROM TECH_COURSE;
(ii) SELECT TID, COUNT(*), MIN(FEES) FROM
TECH_COURSE GROUP BY TID HAVING COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE
FEES>15000 ORDER BY CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE
FEES BETWEEN 15000 AND 17000;
Answer: (a) 
cbse-class-12-computer-science-sample-paper-2023-set-a
(b) (i) DISTINCT TID
101
NULL
102
104
103
(ii) TID COUNT(*) MIN(FEES)
101 2 12000
(iii) CNAME
Digital marketing
Mobile Application Development
(iv) 15500.00

27. Write a method COUNTLINES() in Python to read lines from text file ‘TESTFILE.TXT’ and display the lines which are not starting with any vowel.
Example:
If the file content is as follows:
An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.
The COUNTLINES() function should display the output as:
The number of lines not starting with any vowel - 1
Answer: def COUNTLINES() :
file = open ('TESTFILE.TXT', 'r')
lines = file.readlines()
count=0
for w in lines :
if (w[0]).lower() not in 'aeoiu'
count = count + 1
print ("The number of lines not starting with any
vowel: ", count)
file.close()
COUNTLINES()

OR

Write a function ETCount() in Python, which should read each character of a text file “TESTFILE.TXT” and then count and display the count of occurrence of alphabets E and T individually (including small cases e and t too).
Example:
If the file content is as follows:
Today is a pleasant day.
It might rain today.
It is mentioned on weather sites
The ETCount() function should display the output as:
E or e: 6
T or t : 9
Answer: def ETCount() :
file = open ('TESTFILE.TXT', 'r')
lines = file.readlines()
countE=0
countT=0
for w in lines :
for ch in w:
if ch in 'Ee':
countE = countE + 1
if ch in 'Tt':
countT=countT + 1
print ("The number of E or e : ", countE)
print ("The number of T or t : ", countT)
file.close()

28. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and Placement given below:
Table : Teacher 
cbse-class-12-computer-science-sample-paper-2023-set-a
(i) SELECT Department, avg(salary) FROM Teacher
GROUP BY Department;
(ii) SELECT MAX(Date_of_Join),MIN(Date_of_Join) FROM
Teacher;
(iii) SELECT Name, Salary, T.Department, Place FROM
Teacher T, Placement P WHERE T.Department =
P.Department AND Salary>20000;
(iv) SELECT Name, Place FROM Teacher T, Placement P
WHERE Gender =’F’ AND T.Department=P.Department;
(b) Write the command to view all tables in a database.
Answer: (a) 
(i) Department Avg(Salary)
Computer Sc 16500.00
History 30000.00
Mathematics 25000.00
(ii) Max(Date_of_Join) Min(Date_of_Join)
2021-09-05 2017-03-04
(iii) Name Salary Department   Place
Randeep 30000  Mathematics  Jaipur
Samira  40000   History          Ahmedabad
Raman  25000   Mathematics  Jaipur
Shyam  30000  History          Ahmedabad
Shiv    21000   Computer Sc  Nagpur
(iv) Name Place
Samira     Ahmedabad
Suman     Ahmedabad
Shalaka    Jaipur
(b) SHOW TABLES;

Please click the link below to download CBSE Class 12 Computer Science Sample Paper 2023 Set A

How to download CBSE Class 12 Computer Science Sample Paper 2023 Set A in PDF?

Students can easily download the CBSE Class 12 Computer Science Sample Paper 2023 Set A from our website to prepare for their upcoming examinations. To score high marks, it is important for Class 12 students to understand the exaact pattern as per which teachers design the question papers. We strongly suggest that you practice these latest sample papers for Computer Science and solve different types of questions that are expected to come this year. You can downloadin PDF format so that you can practice offline. We also recommend that Class 12 students solve these papers actual exam conditions at home.

Why should you solve CBSE Class 12 Computer Science Sample Paper 2023 Set A?

Practicing these model papers has several benefits for Class 12 students:

  • New Question Bank: This set has fresh questions for Computer Science which are different from previous years.
  • Exam Pattern Knowledge: Solving more sets will help you to understand the weightage of each chapter in Class 12 and also the type of questions asked.
  • Identify Weak Areas: Comparing your score in each set to find out topics in Class 12 Computer Science for which you need hard work.
  • Speed and Accuracy: Attempting MCQ questions and long-form problems for Class 12 Computer Science makes you faster and better and you will be able to finish your exam on time.

What should you do after solving CBSE Class 12 Computer Science Sample Paper 2023 Set A?

  1. Check Your Work: Match your answers with the solutions given by our teachers in the Computer Science Sample Paper PDF.
  2. Learn from Mistakes: Class 12 students should focus on the questions which you solved incorrectly and understand the error.
  3. Revision: If you find a question difficult you shoul refer to NCERT book for Class 12 Computer Science to understand concepts and then try the question again.
  4. Continuous Practice: Solve multiple sets of Computer Science sample papers from studiestoday.com to build confidence before the CBSE exams.
Where can I download the PDF for CBSE Class 12 Computer Science Sample Paper 2023 Set A?

You can download the complete PDF for CBSE Class 12 Computer Science Sample Paper 2023 Set A for free from StudiesToday.com. Our resources for Class 12 Computer Science are updated for the latest academic session and follow the official exam pattern.

Are solutions provided for CBSE Class 12 Computer Science Sample Paper 2023 Set A?

Yes, CBSE Class 12 Computer Science Sample Paper 2023 Set A comes with detailed, teacher-verified solutions. We have provided step-by-step answers for Computer Science to help students of Class 12 understand correct methodology and marking scheme.

How can practicing CBSE Class 12 Computer Science Sample Paper 2023 Set A help in exam preparation?

Practicing this Computer Science paper helps in time management and identifying important topics. For Class 12, solving mock papers is the best way to gain confidence and reduce exam-day anxiety.

Is the CBSE Class 12 Computer Science Sample Paper 2023 Set A accessible on mobile and tablets?

Yes, all our study materials for Class 12 Computer Science are provided in a mobile-friendly PDF format. You can easily download CBSE Class 12 Computer Science Sample Paper 2023 Set A on your mobile device.