aglasem.com
Home Schools Admission Career Mock Test PDF Docs Playground
ClassChoose class
StateSelect state

CBSE Class 12 Question Paper 2025 Solution Computer Science

Download CBSE Class 12 Question Paper 2025 Solution Computer Science. Here at aglasem.com you can get Answers of CBSE 12th class Question Papers. CBSE Class 12th Computer Science Question Paper 2025 Solution is given below. More Detail
CBSE Class 12 Question Paper 2025 Solution Computer Science - Page 1 of 27

Finished viewing? Save it for later —

Download CBSE Class 12 Question Paper 2025 Solution Computer Science (PDF · 27 pages)
Downloaded 13 times

About CBSE Class 12 Question Paper 2025 Solution Computer Science

CBSE Class 12 Question Paper 2025 Solution Computer Science is available here for free download. Published by CBSE for Class 12, this solution can be viewed online or downloaded as a PDF (27 pages). Candidates preparing for Class 12 can use CBSE Class 12 Question Paper 2025 Solution Computer Science to understand the exam pattern, the type of questions asked, and the overall difficulty level.

Frequently Asked Questions

How can I download CBSE Class 12 Question Paper 2025 Solution Computer Science?

Open this page and click the Download button to save CBSE Class 12 Question Paper 2025 Solution Computer Science as a PDF. It is completely free on AglaSem Docs.

Is CBSE Class 12 Question Paper 2025 Solution Computer Science free to download?

Yes. CBSE Class 12 Question Paper 2025 Solution Computer Science can be viewed online and downloaded as a PDF free of cost on AglaSem Docs.

How many pages does CBSE Class 12 Question Paper 2025 Solution Computer Science have?

CBSE Class 12 Question Paper 2025 Solution Computer Science contains 27 pages, which you can read online or download together as a single PDF.

Where can I find more Class 12 study material?

You can find more Class 12 question papers, sample papers, syllabus, and answer keys on AglaSem Docs.

CBSE Class 12 Question Paper 2025 Solution Computer Science – Text

Read the full text of this solution below — useful to quickly search, copy and reference the content online without downloading the PDF.

📄 View text version (27 pages)

Page 1

Marking Scheme​
Strictly Confidential
(For internal and restricted use only)
Senior Secondary School Examination 2025
SUBJECT NAME: COMPUTER SCIENCE SUBJECT CODE: 083 (Set 4 Q.P. CODE 91)

General Instructions:
1 You are aware that evaluation is the most important process in the actual and correct
assessment of the candidates. A small mistake in evaluation may lead to serious problems
which may affect the future of the candidates, education system and teaching profession.
To avoid mistakes, it is requested that before starting evaluation, you must read and
understand the spot evaluation guidelines carefully.

2 “Evaluation policy is a confidential policy as it is related to the confidentiality of the
examinations conducted, Evaluation done and several other aspects. Its’ leakage to the
public in any manner could lead to derailment of the examination system and affect the
life and future of millions of candidates. Sharing this policy/document to anyone,
publishing in any magazine and printing in News Paper/Website etc. may invite action
under various rules of the Board and IPC.”

3 Evaluation is to be done as per instructions provided in the Marking Scheme. It should not
be done according to one’s own interpretation or any other consideration. Marking Scheme
should be strictly adhered to and religiously followed. However, while evaluating answers
which are based on latest information or knowledge and/or are innovative, they may be
assessed for their correctness otherwise and due marks be awarded to them. In class-X,
while evaluating two competency-based questions, please try to understand the given
answer and even if the reply is not from the marking scheme but correct competency is
enumerated by the candidate, due marks should be awarded.

4 The Marking Scheme carries only suggested value points for the answers.
These are in the nature of Guidelines only and do not constitute the complete answer. The
students can have their own expression and if the expression is correct, the due marks
should be awarded accordingly.

5 The Head-Examiner must go through the first five answer books evaluated by each
evaluator on the first day, to ensure that evaluation has been carried out as per the
instructions given in the Marking Scheme. If there is any variation, the same should be
zero after deliberation and discussion. The remaining answer books meant for evaluation
shall be given only after ensuring that there is no significant variation in the marking of
individual evaluators.

6 Evaluators will mark( √ ) wherever the answer is correct. For wrong answer CROSS ‘X” be
marked. Evaluators will not put right (✓)while evaluating which gives an impression that
the answer is correct and no marks are awarded. This is the most common mistake which
evaluators are committing.

7 If a question has parts, please award marks on the right-hand side for each part. Marks
awarded for different parts of the question should then be totaled up and written in the
left-hand margin and encircled. This may be followed strictly.

8 If a question does not have any parts, marks must be awarded in the left-hand margin and
encircled. This may also be followed strictly.

9 If a student has attempted an extra question, the answer of the question deserving more
marks should be retained and the other answer scored out with a note “Extra Question”.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 1/27 ]

Page 2

10 No marks to be deducted for the cumulative effect of an error. It should be penalized only
once.

11 A full scale of marks 70 marks has to be used. Please do not hesitate to award full marks
if the answer deserves it.

12 Every examiner has to necessarily do evaluation work for full working hours i.e., 8 hours
every day and evaluate 20 answer books per day in main subjects and 25 answer books per
day in other subjects (Details are given in Spot Guidelines).This is in view of the reduced
syllabus and number of questions in question paper.

13 Ensure that you do not make the following common types of errors committed by the
Examiner in the past:-
●​ Leaving the answer or part thereof unassessed in an answer book.
●​ Giving more marks for an answer than assigned to it.
●​ Wrong totaling of marks awarded on an answer.
●​ Wrong transfer of marks from the inside pages of the answer book to the title page.
●​ Wrong question wise totaling on the title page.
●​ Wrong totaling of marks of the two columns on the title page.
●​ Wrong grand total.
●​ Marks in words and figures not tallying/not same.
●​ Wrong transfer of marks from the answer book to online award list.
●​ Answers marked as correct, but marks not awarded. (Ensure that the right tick mark is
correctly and clearly indicated. It should merely be a line. Same is with the X for
incorrect answers.)
●​ Half or a part of the answer marked correct and the rest as wrong, but no marks
awarded.

14 While evaluating the answer books, if the answer is found to be totally incorrect, it should
be marked as cross (X) and awarded zero (0)Marks.

15 Any unassessed portion, non-carrying over of marks to the title page, or totaling error
detected by the candidate shall damage the prestige of all the personnel engaged in the
evaluation work as also of the Board. Hence, in order to uphold the prestige of all
concerned, it is again reiterated that the instructions be followed meticulously and
judiciously.

16 The Examiners should acquaint themselves with the guidelines given in the “Guidelines for
Spot Evaluation” before starting the actual evaluation.

17 Every Examiner shall also ensure that all the answers are evaluated, marks carried over to
the title page, correctly totaled and written in figures and words.

18 The candidates are entitled to obtain a photocopy of the Answer Book on request on
payment of the prescribed processing fee. All Examiners/Additional Head Examiners/Head
Examiners are once again reminded that they must ensure that evaluation is carried out
strictly as per value points for each answer as given in the Marking Scheme.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 2/27 ]

Page 3

MARKING SCHEME
COMPUTER SCIENCE 083
Max. Marks: 70
General Instructions :
(i) This question paper contains 37 questions.
(ii) All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions.
(iii) The paper is divided into 5 Sections - A, B, C, D, E.
(iv) Section A, consists of 21 questions (1 to 21). Each question carries 1 mark.
(v) Section B, consists of 7 questions (22 to 28). Each question carries 2 marks.
(vi) Section C, consists of 3 questions (29 to 31). Each question carries 3 marks.
(vii) Section D, consists of 4 questions (32 to 35). Each question carries 4 marks.

(viii) Section E, consists of 2 questions (36 & 37). Each question carries 5 marks.

(ix) All programming questions are to be answered using Python Language only.
(x) In case of MCQs, text of the correct answer should also be written
Specific Instructions:
●​ The answers given in the marking scheme are SUGGESTIVE. Examiners are requested to
award marks for all alternative correct Solutions/Answers conveying a similar meaning
●​ All programming questions have to be answered with respect to Python only
●​ In Python, ignore case sensitivity for identifiers (Variable / Functions / Structures / Class
Names)
●​ In Python indentation is mandatory, however, the number of spaces used for indenting may
vary
●​ In SQL related questions – both ways of text/character entries should be acceptable for
Example: “AMAR” and ‘amar’ both are acceptable.
●​ In SQL related questions – all date entries should be acceptable for Example: ‘YYYY-MM-DD’,
‘YY-MM-DD’, ‘DD-Mon-YY’, “DD/MM/YY”, ‘DD/MM/YY’, “MM/DD/YY”, ‘MM/DD/YY’ and
{MM/DD/YY} are correct.
●​ In SQL related questions – semicolon should be ignored for terminating the SQL statements
●​ In SQL related questions – ignore case sensitivity
●​ In SQL output questions – ignore the column headers
●​ In SQL output questions – ignore the order of rows until ORDER BY is specified

SECTION A (21x1=21)
1. State True or False: 1
“A Python List must always contain all its elements of same data type.”
Ans False
(1 Mark for writing the correct answer)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 3/27 ]

Page 4

2. What will be the output of the following statement? 1
print(14%3**2*4)
(A) 16 (B) 64
(C) 20 (D) 256

Ans (C) 20
(1 Mark for writing the correct option)
3. Identify the correct output of the following code snippet: 1
game="Olympic2024"
print(game.index("C"))
(A) 0 (B) 6
(C) -1 (D) ValueError
Ans (D) ValueError
(1 Mark for writing the correct option)
4. Which of the following is the correct identifier? 1
(A) global (B) Break
(C) def (D) with

Ans (B) Break
(1 Mark for writing the correct option)
5. Identify the invalid Python statement out of the following options: 1
(A) print("A",10,end="*") (B) print("A",sep="*",10)
(C) print("A",10,sep="*") (D) print("A"*10)

Ans (B) print("A",sep="*",10)
(1 Mark for writing the correct option)
6. Consider the statements given below and then choose the correct output from 1
the given options:
L=['TIC', 'TAC']
print(L[::-1])

(A) ['CIT', 'CAT'] (B) ['TIC', 'TAC']
(C) ['CAT', 'CIT'] (D) ['TAC', 'TIC']

Ans (D) ['TAC', 'TIC']
(1 Mark for writing the correct option)
7. Which of the following operator evaluates to True if the variable on either side 1
of the operator points towards the same memory location and False otherwise?

(A) is (B) is not
(C) and (D) or

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 4/27 ]

Page 5

Ans (A) is
(1 Mark for writing the correct option)
8. Consider the statements given below and then choose the correct output from 1
the given options:
D={'S01':95, 'S02':96 }
for I in D:
print(I,end='#')

(A) S01#S02# (B) 95#96#
(C) S01,95#S02,96# (D) S01#95#S02#96#

Ans (A) S01#S02#
(1 Mark for writing the correct option)
9. While creating a table, which constraint does not allow insertion of duplicate 1
values in the table ?
(A) UNIQUE (B) DISTINCT

(C) NOT NULL (D) HAVING

Ans (A)​UNIQUE
(1 Mark for writing the correct option)
10. Consider the statements given below and then choose the correct output from 1
the given options:
def Change(N):
N=N+10
print(N,end='$$')
N=15
Change(N)
print(N)

(A) 25$$15 (B) 15$$25

(C) 25$$25 (D 2525$$
)

Ans (A) 25$$15
(1 Mark for writing the correct option)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 5/27 ]

Page 6

11. Consider the statements given below and then choose the correct output from 1
the given options:
N='5'
try:
print('WORD' + N, end='#')
except:
print('ERROR',end='#')
finally:
print('OVER')
(A) ERROR# (B) WORD5#OVER

(C) WORD5# (D) ERROR#OVER

Ans (B) WORD5#OVER
(1 Mark for writing the correct option)
12. Which of the following built-in function/method returns a dictionary ? 1

(A) dict() (B) keys()

(C) values() (D) items()

Ans (A) dict()
(1 Mark for writing the correct option)
13. Which of the following is a DML command in SQL ? 1

(A) UPDATE (B) CREATE

(C) ALTER (D) DROP

Ans (A) UPDATE
(1 Mark for writing the correct option)
14. Which aggregate function in SQL displays the number of values in the specified 1
column ignoring the NULL values ?
(A) len() (B) count()

(C) number() (D) num()

Ans (B) count()
(1 Mark for writing the correct option)
15. In MYSQL, which type of value should not be enclosed within quotation marks ? 1

(A) DATE (B) VARCHAR

(C) FLOAT (D) CHAR

Ans (C) FLOAT
(1 Mark for writing the correct option)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 6/27 ]

Page 7

16. State True or False : 1
If table A has 6 rows and 3 columns, and table B has 5 rows and 2 columns, the
Cartesian product of A and B will have 30 rows and 5 columns.
Ans True
(1 Mark for writing the correct answer)
17. Which of the following networking devices is used to regenerate and transmit 1
the weakened signal ahead?
(A) Hub (B) Ethernet Card

(C) Repeater (D) Modem

Ans (C) Repeater
(1 Mark for writing the correct option)
18. Which of the following options is the correct protocol used for phone calls over 1
the Internet?
(A) PPP (B) FTP

(C) HTTP (D) VoIP

Ans (D) VoIP
(1 Mark for writing the correct option)
19. Expand ARPANET. 1

Ans Advanced Research Projects Agency Network
(Full 1 Mark for writing the the correct full form)
OR
(½ Mark for writing any two correct expanded terms)

Q.Nos. 20 and 21 are Assertion (A) and Reason (R) based questions. Mark the
correct choice as
(A)​Both Assertion (A) and Reason (R) are true and Reason (R) is the
correct explanation for Assertion (A).
(B)​Both Assertion (A) and Reason (R) are true and Reason (R) is not the
correct explanation for Assertion (A).
(C)​Assertion (A) is true but, Reason (R) is false.
(D)​Assertion (A) is false but, Reason (R) is true.
20. Assertion (A): For a binary file opened using 'rb' mode, the pickle.dump() 1
method will display an error.

Reason (R): The pickle.dump() method is used to read from a binary file.
Ans (C) ​ Assertion (A) is true, but Reason (R) is false.
(1 Mark for writing the correct option)
21. Assertion (A) : We can retrieve records from more than one table in MYSQL. 1
Reason (R) : Foreign key is used to establish a relationship between two tables.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 7/27 ]

Page 8

Ans (B)​Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct
explanation for Assertion (A).
(1 Mark for writing the correct option)

SECTION B (7x2=14)
22. What does the return statement do in a function ? Explain with the help of 2
an example.
Ans The return statement in Python is used to exit a function and return a value to the caller.
Example :
def Add(A, B):
return A+B
Result=Add(5,3)
print(Result)

Output:
8
(1 Mark for writing the correct explanation)
(1 Mark for writing the correct example)
OR
( Full 2 Marks for correct explanation with the help of a suitable example)
23. Write one example of each of the following in Python : 2
(i) Syntax Error
(ii) Implicit Type conversion
Ans (i) Syntax Error
print(2 ; 5)

(ii) Implicit Type conversion
x=10
y=20.5
print(x+y)
Note:
●​ The above examples are just suggestive. Accept all correct examples
(1 Mark for writing each correct example)
24. Consider the following dictionaries, D and D1 :​ ​ 2
D={"Suman": 40, "Raj":55, "Raman":60}
D1={"Aditi":30, "Amit":90,"Raj":20}
(Answer using built-in Python functions only)
(i)​ (a)​ Write a statement to display/return the value corresponding to the
key "Raj" in the dictionary D.
​ ​ ​ ​ ​ OR
​ (b)​ Write a statement to display the length of the dictionary D1.
(ii)​ (a)​ Write a statement to append all the key-value pairs of the
dictionary D to the dictionary D1.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 8/27 ]

Page 9

​ ​ ​ ​ ​ OR
​ (b)​ Write a statement to delete the item with the given key "Amit"
from the dictionary D1.
Ans
(i)​ (a)​ D.get("Raj") # OR D["Raj"] may also be considered
​ ​ ​ ​ OR
​ (b)​ len(D1) # OR len(D1.items())
# OR len(D1.keys())
# OR len(D1.values())
(ii)​ (a)​ D1.update(D)
​ ​ ​ ​ OR
​ (b)​ D1.pop("Amit") # OR del D1["Amit"]
# may also be considered
(i) (1 Mark for writing the correct statement)
(ii) (1 Mark for writing the correct statement)
25. What possible output from the given options is expected to be displayed when 2
the following code is executed?
import random
Cards=["Heart","Spade","Club","Diamond"]
for i in range(2):
print(Cards[random.randint(1,i+2)],end="#")
(A) Spade#Diamond# (B) Spade#Heart#
(C) Diamond#Club# (D) Heart#Spade#

Ans (A)​Spade#Diamond#
(2 Marks for writing the correct option)
26. The code given below accepts N as an integer argument and returns the sum of 2
all integers from 1 to N. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
def Sum(N)
for I in range(N):
S=S+I
return S
print(Sum(10)
Ans def Sum(N):
S=N
for I in range(N):
S=S+I
return S
print(Sum(10))
OR

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 9/27 ]

Page 10

def Sum(N):
S=0
for I in range(1,N+1): # OR for I in range(N+1):
S=S+I
return S
print(Sum(10))
(Full 2 Marks for writing all required corrections)

OR
(½ Mark for writing the : after def Sum(N) )
(½ Mark for correctly initialising S)
(½ Mark for calculating the correct/required sum S)
(½ Mark for writing the ‘)’ at the end of print(Sum(10) )

OR
(1 Mark for only identification of all/any three errors without correction)
27. Nisha is assigned the task of maintaining the staff data of an organization. She 2
has to store the details of the staff in the SQL table named EMPLOYEES with
attributes as EMPNO, NAME, DEPARTMENT, BASICSAL to store Employee’s
Identification Number, Name, Department and Basic Salary respectively. There
can be two or more Employees with the same name in the organization.
(i)
(a)​Help Nisha to identify the attribute which should be designated as the
PRIMARY KEY. Justify your anwer.
OR

(b)​Help Nisha to identify the constraint which should be applied to the
attribute NAME such that the Employees’ Names cannot be left empty or
NULL while entering the records but can have duplicate values.
Ans (i)
(a)​EMPNO
(i) Employee’s Identification Number always contains unique and not
null values.
(ii) Other attributes may have duplicate values (assuming 2 or more
employees may have same Name, Department or Basic Salary) and
an attribute with possible duplicate values can not be considered
as the Primary Key.
(Any one valid justification)

OR
(b)​NOT NULL
(i) (a)
(½ Mark for suggesting the correct attribute for PRIMARY KEY)
(½ Mark for any one valid justification)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 10/27 ]

Page 11

OR
(i) (b)
(1 Mark for writing the correct constraint for attribute NAME)
(ii)
(a)​Write the SQL command to change the size of the attribute BASICSAL in
the table EMPLOYEES to allow the maximum value of 99999.99 to be
stored in it.
OR
(b)​Write the SQL command to delete the table EMPLOYEES
Ans (ii)
(a)​ALTER TABLE EMPLOYEES ​
MODIFY COLUMN BASICSAL FLOAT(7,2); ​
# OR DECIMAL(7,2)
OR
(b)​DROP TABLE EMPLOYEES;
(a)​(½ Mark for writing ALTER TABLE EMPLOYEES)
(½ Mark for correctly writing remaining part of the command)
OR
(b)​(1 Mark for writing DROP TABLE EMPLOYEES correctly)
OR
(½ Mark for writing DROP TABLE only)
28. (a)​Expand and explain the term URL. 2
OR
(b)​Expand the term PPP. What is the use of PPP?
Ans (a)​URL (Uniform Resource Locator) : It is the unique address of any resource
on the Internet.​
OR
(b)​PPP (Point to Point Protocol) : This protocol is used to establish a dedicated
and direct connection between two communicating devices.
(a)​(1 Mark for writing correct explanation)​
(1 Mark for writing correct expansion)
OR
(½ Mark for writing any two words of correct expansion)
OR
(b)​(1 Mark for writing correct expansion)
(1 Mark for writing correct use)
OR
(½ Mark for writing any two words of correct expansion)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 11/27 ]

Page 12

SECTION C (3x3=9)
29. (a)​Write a Python function that displays all the lines containing the word 3
'vote' from a text file "Elections.txt". For example, if the file
contains :
In an election many people vote to choose their representative.
The candidate getting the maximum share of votes stands elected.
Normally, one person has to vote once.
The process of voting may vary with time and region.

Then the output should be :
In an election many people vote to choose their
representative.
Normally, one person has to vote once.
Ans def PrintVote():
F=open("Elections.txt")​
Lines=F.readlines()
for Line in Lines:
L=Line.split()
if "vote" in L:
print(Line)​
F.close()
OR
def PrintVote():
with open("Elections.txt") as F:​
Lines=F.readlines()
for Line in Lines:
L=Line.split()
if "vote" in L:
print(Line)
OR
def PrintVote():
F=open("Elections.txt")
while True:
Line=F.readline()
if Line!="":
if "vote" in Line.split():
print(Line)
else:
break
F.close()
OR
Any other equivalent correct code
(½ Mark for opening the file in default/correct mode)
(½ Mark for correct reading & iteration)
(½ Mark for correct logic of extracting the word 'vote')
(1 Mark for correct condition)
(½ Mark for displaying line)
OR

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 12/27 ]

Page 13

(b)​Write a Python function that displays all the words starting and ending with
a vowel from a text file "Report.txt". The consecutive words should be
separated by a space in the output. For example, if the file contains :

Once there was a wise man in a village.
He was an awesome story-teller.
He was able to keep people anchored while listening to him.

Then the output should be :
Once a a awesome able
Ans def vowels():
F=open('Report.txt')
Data=F.read()
Words=Data.split()
for Word in Words:
if Word[0] in 'aeiouAEIOU':
if Word[–1] in 'aeiouAEIOU':
print(Word,end=' ')
F.close()
OR
def vowels():
with open('Report.txt') as F:
Data=F.read()
Words=Data.split()
for Word in Words:
if Word[0].upper() in 'AEIOU'
and Word[–1].upper() in 'AEIOU':
print(Word,end=' ')
OR
Any other equivalent correct code
(½ Mark for opening the file in default/correct mode)
(½ Mark for correct reading & iteration)
(½ Mark for correct logic to process each word)
(1 Mark for correct condition)
(½ Mark for displaying word)
30. (a)​A stack, named ClrStack, contains records of some colors. Each record is 3x1
represented as a tuple containing four elements – ColorName, RED, =3
GREEN, BLUE. ColorName is a string, and RED, GREEN, BLUE are
integers. For example, a record in the stack may be ('Yellow', 237,
250, 68)​ ​
Write the following user-defined functions in Python to perform the
specified operations on ClrStack:
(i) push_Clr(ClrStack, new_Clr): This function takes the stack
ClrStack and a new record new_Clr as arguments and pushes this
new record onto the stack.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 13/27 ]

Page 14

(ii) pop_Clr(ClrStack): This function pops the topmost record
from the stack and returns it. If the stack is already empty, the
function should display the message "Underflow".
(iii) isEmpty(ClrStack): This function checks whether the stack is
empty. If the stack is empty, the function should return True,
otherwise the function should return False.

Ans
(i) def push_Clr(ClrStack, new_Clr):
ClrStack.append(new_Clr)

(ii) def pop_Clr(ClrStack):
if len(ClrStack) == 0:
# OR if not ClrStack:
# OR if ClrStack == []:
print("Underflow")
else:
return(ClrStack.pop())

(iii) def isEmpty(ClrStack):
if len(ClrStack) == 0:
# OR if not ClrStack:
# OR if ClrStack == []:
return True
else:
return False

(i)
(1 Mark for correct definition of push_Clr(ClrStack, new_Clr))

(ii)
(½ Mark for correctly checking and displaying “Underflow”)
(½ Mark for correctly popping and returning popped tuple/data)

(iii)
(½ Mark for correctly checking whether the Stack is Empty or not)
(½ Mark for correctly returning/printing the required values)
OR
(b)​Write the following user-defined functions in Python :
(i) push_trail(N,myStack): Here N and myStack are lists, and
myStack represents a stack. The function should push the last 5
elements from the list N onto the stack myStack. For example, if
the list N is [1,2,3,4,5,6,7], then the function
push_trail() should push the elements 3,4,5,6,7 onto the
stack. Therefore the value of stack will be [3,4,5,6,7].

Assume that N contains at least 5 elements.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 14/27 ]

Page 15

(ii) pop_one(myStack): The function should pop an element from
the stack myStack, and return this element. If the stack is empty,
then the function should display the message 'Stack
Underflow', and return None.

(iii) display_all(myStack): The function should display all the
elements of the stack myStack, without deleting them. If the
stack is empty, the function should display the message 'Empty
Stack'.

Ans (b)
(i) def push_trail(N,myStack):
for i in range(-5,0,1): # Any other correct loop
myStack.append(N[i])

(ii) def pop_one(myStack):
if not myStack: #OR if myStack==[]:
#OR if len(myStack)==0:
print('Stack Underflow')
else:
return myStack.pop()

(iii) def display_all(myStack):
if not myStack: #OR if myStack==[]:
#OR if len(myStack)==0:
print("Empty Stack")
else:
for i in myStack[::–1]: # print(myStack[::-1])
print(i,end=' ') # -

(i)
(1 Mark for correct definition of push_trail(N,myStack))
(ii)
(½ Mark for correctly checking and displaying “Stack Underflow”)
(½ Mark for correctly popping and returning last element)
(iii)
(½ Mark correctly checking Empty condition)
(½ Mark correctly displaying content till the last value in the stack)
31. (a)​ Predict the output of the following code : 3
def ExamOn(mystr) :
​ newstr = ""
​ count = 0
​ for i in mystr:
​ if count%2 != 0:
​ ​ newstr = newstr + str(count–1)
else:
newstr = newstr + i.lower()
count += 1

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 15/27 ]

Page 16

newstr = newstr + mystr[:2]
print("The new string is:", newstr)
ExamOn("GenX")
Ans The new string is: g0n2Ge
(½ Mark for each correct letter/digit in the right order)

Note:
(2½ Marks only to be awarded, if all the parts of g0n2Ge is written
correctly without the text ‘The new string is:’)
OR
(b) Write the output on execution of the following Python code:
def Change(X):
for K,V in X.items():
L1.append(K)
L2.append(V)
D={1:"ONE",2:"TWO",3:"THREE"}
L1=[]
L2=[]
Change(D)
print(L1)
print(L2)
print(D)

Ans Note: Considering two lines after the for loop indented
[1, 2, 3]
['ONE', 'TWO', 'THREE']
{1: 'ONE', 2: 'TWO', 3: 'THREE'}

OR
Note: Considering only first line after the for loop to be indented
[1, 2, 3]
['THREE']
{1: 'ONE', 2: 'TWO', 3: 'THREE'}

(1 Mark for writing each correct line of output)
OR
(Full 3 Marks for writing indentation error)

SECTION D (4x4=16)
32. Suman has created a table named WORKER with a set of records to maintain 4
the data of the construction sites, which consists of WID, WNAME, WAGE,
HOURS, TYPE, and SITEID. After creating the table, she entered data in it,
which is as follows :

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 16/27 ]

Page 17

WID WNAME WAGE HOURS TYPE SITEID
W01 Ahmed J 1500 200 Unskilled 103
W11 Naveen S 520 100 Skilled 101
W02 Jacob B 780 95 Unskilled 101
W15 Nihal K 560 110 Semiskilled NULL
W10 Anju S 1200 130 Skilled 103

(a) Based on the data given above, answer the following questions :

(i) Write the SQL statement to display the names and wages of those workers
whose wages are between 800 and 1500.
Ans SELECT WNAME, WAGE FROM WORKER
WHERE WAGE BETWEEN 800 AND 1500;
OR
SELECT WNAME, WAGE FROM WORKER
WHERE WAGE>=800 AND WAGE<=1500;

(½ Mark for correctly writing SELECT WNAME, WAGE FROM WORKER)
(½ Mark for correctly writing WHERE WAGE BETWEEN 800 AND 1500)

(ii) Write the SQL statement to display the record of workers whose SITEID is
not known.
Ans SELECT * FROM WORKER
WHERE SITEID IS NULL;

(½ Mark for correctly writing SELECT * FROM WORKER or Equivalent)
(½ Mark for correctly writing WHERE SITEID IS NULL)

(iii) Write the SQL statement to display WNAME, WAGE and HOURS of all those
workers whose TYPE is 'Skilled'.
Ans SELECT WNAME, WAGE, HOURS FROM WORKER
WHERE TYPE="Skilled";

(½ Mark for writing SELECT WNAME, WAGE, HOURS FROM WORKER)
(½ Mark for writing WHERE TYPE = "Skilled")

(iv) Write the SQL statement to change the WAGE to 1200 of the workers where
the TYPE is "Semiskilled"
Ans UPDATE WORKER SET WAGE=1200
WHERE TYPE="Semiskilled";

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 17/27 ]

Page 18

(½ Mark for writing UPDATE WORKER SET WAGE=1200)
(½ Mark for writing WHERE TYPE = "Semiskilled")

OR
(b) Considering the above given table WORKER, write the output on
execution of the following SQL commands:
(i) SELECT WNAME, WAGE*HOURS FROM WORKER ​
WHERE SITEID = 103;
Ans
WNAME WAGE*HOURS
Ahmed J 300000
Anju S 156000

(1 Mark for writing correct output)
(ii) SELECT COUNT(DISTINCT TYPE) FROM WORKER ;
Ans
COUNT(DISTINCT TYPE)
3

(1 Mark for writing correct output)
(iii) SELECT MAX(WAGE), MIN(WAGE), TYPE FROM WORKER ​
GROUP BY TYPE;
Ans
MAX(WAGE) MIN(WAGE) TYPE
1500 780 Unskilled
1200 520 Skilled
560 560 Semiskilled

(1 Mark for writing correct output)
(iv) SELECT WNAME, SITEID FROM WORKER WHERE TYPE="Unskilled"​
ORDER BY HOURS;
Ans
WNAME SITEID
Jacob B 101
Ahmed J 103

(1 Mark for writing correct output)
33. A csv file "P_record.csv" contains the records of patients in a hospital. Each 4
record of the file contains the following data :
●​ Name of a patient
●​ Disease
●​ Number of days patient is admitted
●​ Amount

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 18/27 ]

Page 19

For example, a sample record of the file may be :
​ ["Gunjan","Jaundice",4,15000]
​ Write the following Python functions to perform the specified operations on
this file :

(i) Write a function read_data() which reads all the data from
the file and displays the details of all the 'Cancer' patients.

(ii) Write a function count_rec() which counts and returns the
number of records in the file.
Ans (i)
import csv
def read_data():
F=open("P_record.csv","r")
Records=list(csv.reader(F))
for R in Records :
if R[1]=="Cancer":
print(R)
F.close()
(ii)
def count_rec():
with open("P_record.csv","r") as F:
Records=list(csv.reader(F))
print(len(Records))

(i)
(½ Mark for opening the csv file in correct mode)
(½ Mark for reading the records from csv file)
(½ Mark for iteration of records)
(½ Mark for checking and displaying the matched records correctly)

(ii)
(½ Mark for opening the csv file in correct mode)
(½ Mark for reading the records from csv file)
(1 Mark for finding/counting & displaying the number of records)

34. Assume that you are working in the IT Department of a Creative Art Gallery 4x1
(CAG), which sells different forms of art creations like Paintings, Sculptures etc. =4
The data of Art Creations and Artists are kept in tables Articles and Artists
respectively. Following are few records from these two tables :
Table : Articles
Code A_Code Article DOC Price
PL001 A0001 Painting 2018-10-19 20000
SC028 A0004 Sculpture 2021-01-15 16000
QL005 A0003 Quilling 2024-04-24 3000

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 19/27 ]

Page 20

Table : Artists
A_Code Name Phone Email DOB
A0001 Roy 595923 [email protected] 1986-10-12
A0002 Ghosh 1122334 [email protected] 1972-02-05
A0003 Gargi 121212 [email protected] 1996-03-22
A0004 Mustafa 33333333 [email protected] 2000-01-01

Note :​
●​ The tables contain many more records than shown here.
●​ DOC is Date of Creation of an Article.

As an employee of CAG, you are required to write the SQL queries for the
following :
(i)​ To display all the records from the Articles table in descending
order of price.
(ii)​ To display the details of Articles which were created in the year
2020.
(iii)​ To display the structure of Artists table.
(iv)​ (a)​ To display the name of all Artists whose Article is
Painting through Equi Join.
​ ​ ​ ​ ​ OR
(b)​ To display the name of all Artists whose Article is 'Painting'
through Natural Join.
Ans (i) SELECT * FROM Articles
ORDER BY PRICE DESC;
(½ Mark for SELECT * FROM Articles or similar)
(½ Mark for ORDER BY PRICE DESC)
(ii) SELECT * FROM Articles
WHERE DOC LIKE '2020%';
OR
SELECT * FROM Articles
WHERE DOC>='2020-01-01' AND DOC<='2020-12-31';
OR
SELECT * FROM Articles
WHERE DOC BETWEEN '2020-01-01' AND '2020-12-31';
(½ Mark for SELECT * FROM Articles or similar)
(½ Mark for WHERE DOC LIKE '2020%' OR any other correct equivalent)
(iii) DESC Artists;

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 20/27 ]

Page 21

(½ Mark for DESC)
(½ Mark for mentioning Artists after DESC)

(iv)
(a)​SELECT Name FROM Articles A1, Artists A2
WHERE A1.A_code = A2.A_code AND Article='Painting';
OR
Any other equivalent SQL statement
(½ Mark for SELECT Name FROM Articles A1, Artists A2 or similar)
(½ Mark for WHERE A1.A_code = A2.A_code AND Article='Painting';)
OR
(b)​SELECT Name FROM Articles NATURAL JOIN Artists
WHERE Article = 'Painting';
OR
Any other equivalent SQL statement
(½ Mark for selecting from both the tables)
(½ Mark for correctly using condition/correctly using join option)
35. 4
A table, named THEATRE, in CINEMA database, has the following structure :
Fields Type
Th_ID char(5)
Name varchar(15)
City varchar(15)
Location varchar(15)
Seats int

Write a function Delete_Theatre(), to input the value of Th_ID from the user and
permanently delete the corresponding record from the table.

Assume the following for Python-Database connectivity :
Host : localhost, User : root, Password : Ex2025
Ans import pymysql as pm # OR import mysql.connector as pm
def Delete_Theatre():
Mydb=pm.connect(host = 'localhost',
user = 'root', password = 'Ex2025', database = 'CINEMA')
MyCursor = Mydb.cursor()
TID = input("Theatre ID:")
Query = "DELETE FROM Theatre WHERE Th_ID='{}'".format(TID)
# Query = f"DELETE FROM Theatre WHERE Th_ID='{TID}'"
# Query = "DELETE FROM Theatre WHERE Th_ID='%s'"%(TID,)
# Query = "DELETE FROM Theatre WHERE Th_ID='"+TID+"'"
MyCursor.execute(Query)
Mydb.commit()
Mydb.close()

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 21/27 ]

Page 22

OR
import pymysql as pm # OR import mysql.connector as pm
def Delete_Theatre():
Mydb=pm.connect(host = 'localhost',
user = 'root', password = 'Ex2025', database = 'CINEMA')
MyCursor = Mydb.cursor()
TID = input("Theatre ID:")
Query = "DELETE FROM Theatre WHERE Th_ID=%s"
Data=(TID,)
MyCursor.execute(Query, Data)
Mydb.commit()
Mydb.close()

OR
any equivalent valid code
(1 Mark for creating correct connectivity)
(1 Mark for creating the cursor)
(1 Mark for correct formation of Query)
(½ Mark for correct execution of the query)
(½ Mark for correctly using commit() )

Note:
(½ Mark for importing correct module, if the marks allocated are less than 4)

SECTION E (2x5=10)
36. A file, PASSENGERS.DAT, stores the records of passengers using the 5
following structure :
[PNR, PName, BRDSTN, DESTN, FARE]
where :
PNR​ ​ –​ Passenger Number (string type)
PName​ –​ Passenger Name (string type)
BRDSTN​ –​ Boarding Station Name (string type)
DESTN​ –​ Destination Station Name (string type)
FARE​​ –​ Fare amount for the journey (float type)
Write user defined functions in Python for the following tasks :​
(i)​ Create() – to input data for passengers and write it in the binary
file PASSENGERS.DAT.
(ii)​ SearchDestn(D) –to read contents from the file PASSENGERS.DAT
and display the details of those Passengers whose DESTN matches
with the value of D.
(iii)​ UpdateFare() – to increase the fare of all passengers by 5% and
rewrite the updated records into the file PASSENGERS.DAT.

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 22/27 ]

Page 23

Ans (i) import pickle
​ def Create():
​ F=open("PASSENGERS.DAT", "wb")
​ PNR=input("PNR No:")
​ PName=input("Name: ")
​ BRDSTN=input("Boarding at: ")
​ DESTN=input("Destination: ")
​ FARE=float(input("Fare: "))
​ Rec=[PNR,PName,BRDSTN,DESTN,FARE]
​ pickle.dump(Rec,F)
​ F.close()
OR
def Create():
​ F=open("PASSENGERS.DAT", "wb")
​ REC=[]
while True:
PNR=input("PNR No:")
​ PName=input("Name: ")
​ BRDSTN=input("Boarding at: ")
​ DESTN=input("Destination: ")
​ FARE=float(input("Fare: "))
​ Rec.append([PNR,PName,BRDSTN,DESTN,FARE])
C=input("More(Y/N)?")
if C =='N':
break
​ pickle.dump(Rec,F)
​ F.close()
OR
Any other equivalent code
(ii)
def SearchDestn(D):
try: # To be ignored
​ F=open("PASSENGERS.DAT", "rb")
Rec=pickle.load(F)
for R in Rec:
if R[3]==D;
​ ​ print(R)
F.close()
​ except: # To be ignored
​ ​ print("File not found!") # To be ignored
​ OR
def SearchDestn(D):
​ F=open("PASSENGERS.DAT", "rb")
try:
​ while True:
​ Rec=pickle.load(F)
​ ​ if Rec[3]==D;
​ ​ ​ print(Rec)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 23/27 ]

Page 24

​
except EOFError:
​ print("EOF reached")
F.close()

(iii)
def UpdateFare():
try:
FR=open("PASSENGERS.DAT", "rb+")
Rec=pickle.load(FR)
for I in range(len(Rec)):
Rec[I][4]+=(Rec[I][4] * 0.05)
# Rec[I][4]=Rec[I][4] * 1.05)
print("Updation Done!")
F.seek(0)
pickle.dump(Rec, FR)
FR.Close()
except:
print("File not found!")
OR
def UpdateFare():
FR=open("PASSENGERS.DAT", "rb")
Rec=[]
try:
while True:
R=pickle.load(FR)
Rec.append(R)
except:
FR.close()
for I in range(len(Rec)):
Rec[I][4] = Rec[I][4] + (Rec[I][4] * 0.05)
# Rec[I][4]=Rec[I][4] * 1.05)
FP=open("PASSENGERS.DAT", "wb")
pickle.dump(Rec, FP)
FP.Close()
OR
Any other equivalent code
(i)
(½ Mark for opening the file in correct mode)
(½ Mark for accepting from user/writing on file)
(ii)
(½ Mark for opening the file in correct mode)
(½ Mark for reading each record)
(½ Mark for correctly checking the condition)
(½ Mark for correctly printing the details of passengers)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 24/27 ]

Page 25

(iii)
(½ Mark for opening the file in correct mode)
(½ Mark for reading data)
(½ Mark for correctly modifying the Fare)
(½ Mark for writing the modified Fare in the Binary File)
37. ‘Swabhaav’ is a big NGO working in the field of Psychological Treatment and 5x1
Counselling, having its Head Office in Nagpur. It is planning to set up a center in =5
Vijayawada. The Vijayawada Center will have four blocks –ADMIN, PSYCHIATRY,
PSYCHOLOGY, and ICU. You, as a Network Expert, need to suggest the best
network-related solutions for them to resolve the issues/problems mentioned in
questions (i) to (v), keeping the following parameters in mind :

Block to Block distances (in metres) :
From To Distance
ADMIN PSYCHIATRY 65 m
ADMIN PSYCHOLOGY 65 m
ADMIN ICU 65 m
PSYCHIATRY PSYCHOLOGY 100 m
PSYCHIATRY ICU 50 m
PSYCHOLOGY ICU 50 m

Distance of Nagpur Head Office from Vijayawada Center = 700 km
Number of Computers in each block is as follows :
Block No. of Computers
ADMIN 16
PSYCHIATRY 40
PSYCHOLOGY 19
ICU 20

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 25/27 ]

Page 26

(i) Suggest the most appropriate location of the server inside the
Vijayawada Center. Justify your choice.

(ii) Which hardware device will you suggest to connect all the computers
within each block of Vijayawada Center ?
(iii) Draw a cable layout to efficiently connect various blocks within the
Vijayawada Center.
(iv) Where should the router be placed to provide internet to all the
computers in the Vijayawada Center?
(v) (a)​The Manager at Nagpur wants to remotely access the computer in
Admin block in Vijayawada. Which protocol will be used for this ?
OR
(b)​Which type of Network (PAN, LAN, MAN or WAN) will be set up
among the computers connected with Vijayawada Center ?

Ans (i) PSYCHIATRY Block as it has the maximum number of Computers.
​ ​ ​ ​ OR
​ ADMIN Block as is generally the most secure.
​ ​ ​ ​ OR
​ ADMIN Block as is closest to all the blocks.
​ ​ ​ ​ OR
​ Any other location with valid justification.
(1 Mark for suggesting a block with valid justification)
(ii) Switch/Hub/Router (Any one)
(1 Mark for writing correct answer)
(iii)

OR

OR

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 26/27 ]

Page 27

OR
Any other valid efficient cable layout
(1 Mark for drawing the correct cable layout)
(iv) Router should be placed where the server is placed.

Note: ​
As per the recent network technologies, Router can be connected in any of the
blocks as all the blocks are networked. So, the marks should be awarded
accordingly.
(1 Mark for writing the correct answer)
(v)
(a)​TELNET
OR
(b)​LAN or MAN or WAN (Not PAN)
(a)​(1 Mark for writing the correct answer)
OR
(b)​(1 Mark for writing the correct answer)

[ CBSE MS Computer Science Subject Code 083 Paper Code 91 Class 12 Main 2025 Page: 27/27 ]

Document Details

Board / OrgCBSE
ExamClass 12
TypeSolution
Pages27
Updated24 Sep 2026