Com Sci 2025
Com Sci 2025
COMPUTER SCIENCE
Class-12th
(Solved)
(Delhi & Outside Delhi Sets)
Time : 3 Hours Max. Marks : 70
General Instructions:
(i) Please check 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 and 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.
def Sum(N)
Once there was a wise man in a village.
for I in range (N): He was an awesome story-teller.
S=S+I He was able to keep people anchored while
listening to him.
return S
Then the output should be:
print(Sum(10)
Once a a awesome able
27. Nisha is assigned the task of maintaining the staff
30. (a) A stack, named ClrStack, contains records of
data of an organization. She has to store the details some colors. Each record is represented as a tuple
of the staff in the SQL table named EMPLOYEES containing four elements – colorName, RED,
with attributes as EMPNO, NAME, DEPARTMENT, GREEN, BLUE. ColorName is a string, and
BASICSAL to store Employee's Identification RED, GREEN, BLUE are integers. For example,
Number, Name, Department, and Basic Salary a record in the stack may be ('Yellow', 237,
respectively. There can be two or more Employees 250, 68)
with the same name in the organization. Write the following user-defined functions in
(i) (a) Help Nisha to identify the attribute which Python to perform the specified operations on
ClrStack:
should be designated as the PRIMARY KEY.
Justify your answer. (i) push_Clr(ClrStack, new_Clr): This
function takes the stack ClrStack and a new
OR record new_Clr as arguments and pushes
(b) Help Nisha to identify the constraint which this new record onto the stack.
should be applied to the attribute NAME such (ii) pop_Clr(ClrStack): This function pops
that the Employee's Names cannot be left the topmost record from the stack and returns
empty or NULL while entering the records it. If the stack is already empty, the function
but can have duplicate values. should display the message "Underflow".
(ii) (a) Write the SQL command to change the (iii) i sEmpty(ClrStack): This function
checks whether the stack is empty. If the
size of the attribute BASICSAL in the table
stack is empty, the function should return
EMPLOYEES to allow the maximum value of True, otherwise the function should return
99999.99 to be stored in it. False.
OR OR
(b) Write the SQL command to delete the table (b) Write the following user-defined functions in
EMPLOYEES. Python:
28. (a) Expand and explain the term URL. (i) push_trail(N,myStack): Here N and
mystack are lists, and myStack represents
OR a stack. The function should push the last
(b) Expand the term PPP. What is the use of PPP ? 5 elements from the list N onto the stack
MyStack. For example, if the list N is [1,2,
SECTION – C 3,4,5,6,7], then the function push_
trail() should push the elements 3, 4,
29. (a) Write a Python function that displays all the 5, 6, 7 onto the stack. Therefore the value
lines containing the word 'vote' from a text of stack will be [3,4,5,6,7].
file "Elections.txt". For example, if the file Assume that N contains at least 5 elements.
contains:
(ii) pop_one(mystack): The function should
In an election many people vote to choose their pop an element from the stack myStack.
representative. and return this element. If the stack is empty,
The candidate getting the maximum share of vote then the function should display the message
'Stack Underflow'. and return None.
stands elected.
(iii) d isplay_all(mystack): The function
Normally, one person has to vote once. should display all the element of the stack
The process of voting may vary with time and region. myStack, without deleting them. If the
Then the output should be: stack is empty, the function should display
the message 'Empty stack'.
In an election many people vote to choose their
31. (a) Predict the output of the following code:
representative.
def ExamOn(mystr) :
Normally, one person has to vote once.
newstr = ""
OR
count = 0
(b) W
rite a Python function that displays all the
for i in mystr:
words starting and ending with a vowel from
a text file "Report.txt". The consecutive if count%2 ! = 0:
words should be separated by a space in the
newstr = newstr +
output. For example, if the file contains: str(count-1)
4 Oswaal CBSE Question Bank Chapterwise & Topicwise, Computer Science, Class-XII
(iii) To display the structure of Artists table. a center in Vijayawada. The Vijayawada Center
(iv) (a) To display the names of all artists whose Articles will have four blocks — ADMIN, PSYCHIATRY,
is painting through Equi Join. PSYCHOLOGY, and ICU. You, as a Network Expert,
OR need to suggest the best network-related solutions
for them to resolve the issue/problems mentioned in
(b) To display the name of all Artists whose
questions (i) to (v), keeping the following parameters
Article is 'Painting' through Natural Join.
in mind:
35. A table, named THEATER, in CINEMA database, has
the following structure: ADMIN ADMIN
Block Block
Field Type Vijayawada Center
Th_ID char(5) PSYCHIATRY ICU
Name varchar(15) Block Block
SECTION – E
Distance of Nagpur Head Office from Vijayawada
center = 700 km
36. A file, PASSENGER.DAT, stores the records of
passengers using the following structure : Block No. of Computers
[PNR, PName, BRDSTN, DESTN, FARE] ADMIN 16
where: PSYCHIATRY 40
PSYCHOLOGY 19
PNR — Passenger Number (string
type) ICU 20
PName — Passenger Name (string type)
(i) Suggest the most appropriate location of the
BRDSTN — Boarding Station Name (string server inside the Vijayawada Center. Justify your
type)
choice.
DESTN — D
estination Station Name
(ii) Which hardware device will you suggest to
(string type)
connect all the computer within each block of
FARE — F
are amount for the journey
(float type) Vijayawada Center?
Write user defined functions in Python for the (iii) Draw a cable layout to efficiently connect
following tasks: various blocks within the Vijay wada Center.
Create () — to input data for passengers and
(i) (iv) Where should the router be placed to provide
write it in the binary file PASSENGERS. DAT. internet to all the computer in the Vijayawada
(ii) SearchDestn(D) — to read contents from the Center?
file PASSENGERS.DAT and display the details of
(v) (a) The Manager at Nagpur wants to remotely
those Passengers whose DESTN matches with
the value of D. access the computer in Admin block in
Vijayawada. Which protocol will be used for
(iii) UpdateFare() — to increase the fare of all
passengers by 5% and rewrite the updated this?
records into the file PASSENGERS.DAT. OR
37. 'Swabhaav' is a big NGO working in the field of (b) Which type of Network (PAN, LAN, MAN or
Psychological Treatment and Counselling, having WAN) will be set up among the computers
its Head Office in Nagpur. It is planning to set up connected with Vijaywada Center?
6 Oswaal CBSE Question Bank Chapterwise & Topicwise, Computer Science, Class-XII
ANSWERS
SECTION – A 12. Option (A) is correct.
1. False Explanation: The dict() function creates a blank
Explanation: Python lists allow the storage of dictionary and returns the memory handle of the
different types of data. dictionary created to the variable on the left.
Example : L=[1,2,3,4] 13. Option (A) is correct.
Explanation: Update is a data manipulation
L1 = [“Abc”,12,15.5,True]
command that makes changes to the data of the
2. Option (C) is correct
table. Create, Alter and DROP are all data definition
Explanation: 14%3 **2*4 commands to create, change or remove a table.
=14%9*4 14. Option (B) is correct.
=5*4 Explanation: The count() function is an aggregate
=20 function that counts the number of NON NULL
(** has the highest priority) values in a column.
3. Option (D) is correct 15. Option (C) is correct.
Explanation: Since the character ‘C’ is not present in Explanation: Float is purely real numeric values,
the string “Olympic2024”, the index() function hence should not be enclosed in quotes. DATE,
returns a ValueError. varchar and char should be enclosed in quotes.
4. Option (B) is correct 16. True
Explanation: In Python, keywords are case-sensitive, Explanation: In case of the Cartesian product of
and break is a keyword, but Break (capitalized) is tables A,B
not. Since identifiers cannot be Python keywords, Degree of resultant= DegreeA + DegreeB
but Break (uppercase) is not a keyword, it can be
Cardinality of resultant= CardinalityA x
used as an identifier.
CardinalityB
5. Option (B) is correct
Here Degree = 3+2=5
Explanation: To print certain values with a separa-
Cardinality= 6 × 5=30
tor, all the values should be specified first and then
17. Option (C) is correct.
the sep keyword has to be used.
Explanation: A Repeater is a network device that
6. Option (D) is correct
regenerates and amplifies the source signal, so that
Explanation: The statement L[: :-1] means to
it can travel to a larger distance.
print from end index to index 0 decrementing by 1.
Hence the list is printed in reverse. 18. Option (D) is correct.
7. Option (A) is correct Explanation: The VOIP – Voice Over Internet
Protocol – is used for video and voice transmission
Explanation: The 'is' identity operator returns
True by checking the variables on either side of it, over internet.
that whether they are pointing towards the same 19. ARPANET: Advanced Research Projects Agency
memory location, otherwise it returns False. Network
8. Option (A) is correct. 20. Option (C) is correct.
Explanation: Explanation: The statement “for I in D” Explanation: pickle.dump() method writes data to
means, for I in D.keys(), hence the statement picks a binary file, hence for files opened with “rb” (read
each of the keys of the dictionary and prints them binary) mode the above method will give error.
with the end as ‘#’ 21. Option (B) is correct.
9. Option (A) is correct. Explanation: A foreign key establishes a relationship
Explanation: The UNIQUE constraint restricts between tables, which helps retrieve data from
duplicate values in the column where it is applied. multiple tables; however, the stated reason does not
10. Option (A) is correct. justify the assertion.
Explanation: The value of the formal parameter
to the function is incremented by 10 inside the SECTION – B
Change() function and printed as 25. Outside the 22. The return statement either returns the control
function the actual value of N is printed, which is 15. to the calling function or returns a value from the
Hence the output is 25$$15 called function to the calling function.
11. Option (B) is correct. def sum(A,B):
Explanation: Since there is no exception here,
return A+B
the try and finally blocks are executed, therefore s=sum(10,20)
print(“WORD”+ N, end=’#’) and print(‘OVER’) Here the sum() function receives A, B and returns
are executed giving “WORD5#OVER” the sum of A,B to s.
Solved Paper - 2025 7
23. (i) OR
Syntax Error : if x> 50 (b) PPP: Point-to-Point Protocol.
print(“Hello’) It is a data link layer protocol used to establish a
Missing “:” after the if statement and direct connection between two network nodes,
mismatched quotes in print() commonly used for dial-up and DSL internet
connections, enabling authentication, encryption
Corrected code: and data compression.
if x > 50: SECTION – C
print("Hello") 29. (a)
(ii) Implicit type conversion def vote():
x=55 f=open(“Elections.txt”)
y=6.76 slst=f.readlines()
y=x for line in slst:
The integer value of x is automatically wordlst=line.split()
converted to float type value in y.
if “vote” in wordlst:
24. (i) (a) D.get(“Raj”)
print(line)
OR
f.close()
(b) len(D1)
(ii) (a) D1.update(D) OR
OR (b)
(b) D1.pop(“Amit”) def votvowele():
Explanation: The get() method returns the value f=open(“Report.txt”)
for the key specified in a dictionary. slst=f.readlines()
The len() method returns the number of items in a for line in slst:
dictionary. wordlst=line.split()
The update() method updates the values of a for w in wordlst:
dictionary by another if w[0] in “aeiouAEIOU” and
The pop() method removes a key:value pair w[-1] in “aeiouAEIOU”:
from the dictionary. print(w,” “)
25. Option (A) is correct. f.close()
Explanation: The range function returns the values
30. (a)
0,1, hence the values of i will be 0 and 1 in the two
(i) def push_Clr(ClrStack,new_Clr):
iterations. Therefore the parameters to the randint()
function will be 1,2 and 1,3 thereby giving the values ClrStack.append(new_Clr)
“Spade” in the 1st iteration and “Club” or “Diamond” print(“1 element pushed…”)
in the 2nd iteration. Therefore the possible option is (ii) def pop_Clr(ClrStack):
(A). if ClrStack==[]:
26. Corrected code print(“Underflow”)
def Sum(N): Colon missing else:
S = 0 print(ClrStack.pop())
for I in range(1,(N+1)): Incorrect (iii) def isEmpty(ClrStack):
loop if ClrStack==[]:
S=S+I
return True
return S
else:
print(Sum(10)) Braces missing.
return False
27. (i) (a) EMPNO : As name of employee can be
duplicate.
OR
OR
(b)
(b) NOT NULL : Restricts input of NULL values but
allows duplicate values. (i)def push_trail(N,myStack):
(ii) (a) Alter table Employees Modify Basicsal for i in range(-5, 0 , 1) :
Decimal (8,2); myStack.append(i)
OR (ii)def pop_one(myStack):
(b) Drop table Employees; if myStack==[] :
28. (a) URL: Uniform Resource Locator print(“Stack Underflow”)
The term URL refers to the unique address identified return None
by an IP address. Simply speaking, it is the complete else:
path to a website or web address. myStack.pop()
8 Oswaal CBSE Question Bank Chapterwise & Topicwise, Computer Science, Class-XII