KEMBAR78
Com Sci 2025 | PDF | Function (Mathematics) | Computing
0% found this document useful (0 votes)
7 views9 pages

Com Sci 2025

The document is a solved examination paper for Class 12 Computer Science under CBSE for the year 2025, consisting of 37 questions divided into five sections with varying marks. It includes multiple-choice questions, programming tasks, and SQL-related queries, all requiring answers in Python. The paper emphasizes internal choices in certain questions and mandates the use of Python for programming-related queries.

Uploaded by

roohforreal08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Com Sci 2025

The document is a solved examination paper for Class 12 Computer Science under CBSE for the year 2025, consisting of 37 questions divided into five sections with varying marks. It includes multiple-choice questions, programming tasks, and SQL-related queries, all requiring answers in Python. The paper emphasizes internal choices in certain questions and mandates the use of Python for programming-related queries.

Uploaded by

roohforreal08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CBSE EXAMINATION PAPER-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.

Delhi Set-1 56/1/1

SECTION – A (A) ['CIT', 'CAT'] (B) ['TIC', 'TAc']


(C) ['CAT', 'CIT'] (D) ['TAC', 'TIC']
1. State True or False:
7. Which of the following operator evaluates to True
"A Python List must always contain all its elements
if the variable on either side of the operator points
of same data type."
towards the same memory location and False
2. What will be the output of the following statement? otherwise?
print (14%3**2*4) (A) is (B) is not
(A) 16 (B) 64 (C) and (D) or
(C) 20 (D) 256 8. Consider the statements given below and then
3. Identify the correct output of the following code choose the correct output from the given options:
snippet: D={'S01':95, 'S02':96}
game = "olympic2024" for I in D :
print(game. index("c")) print(I,end='#')

(A) 0 (B) 6 (A) S01#S02# (B) 95#96#

(C) –1 (D) ValueError (C) S01,95#S02,96# (D) S01#95#S02#96#
4. Which of the following is the correct identifier: 9. While creating a table, which constraint does not
(A) global (B) Break allow insertion of duplication value in the table?
(C) def (D) with (A) UNIQUE (B) DISTINCT
5. Identify the invalid Python statement out of the (C) NOT NULL (D) HAVING
following options: 10. Consider the statement given below and then
(A) print("A",10,end="*") choose the correct output from the given options:
(B) print("A",sep="*",10)
def Change(N):
(C) print("A",10,sep="*")
(D) print("A"*10) N=N+10
6. Consider the statements given below and then print (N, ends='$$')
choose the correct output from the given options: N=15
L=['TIC','TAC'] Change(N)

print(L[::–1])
print(N)
2 Oswaal CBSE Question Bank Chapterwise & Topicwise, Computer Science, Class-XII

(A) 25$$15 (B) 15$$25 Assertion (A).


(C) 25$$25 (D) 2525$$ (C) Assertion (A) is True but, Reason (R) is False.
11. Consider the statements given below and then (D) Assertion (A) is False but, Reason (R) is True.
choose the correct output from the given options:
20. Assertion (A): For a binary file opened using 'rb'
N='5'
mode, the pickle.dump() method will display an

try: error.
print('WORD' + N, end='#') Reason (R): The pickle.dump() method is used
to read from a binary file.

except:
21. Assertion (A): We can retrieve records from more
print('ERROR',end='#')
than one table in MYSQL.

finally: Reason (R): Foreign key is used to establish a
print('OVER') relationship between two tables.
(A) ERROR# (B) WORD5#OVER SECTION – B
(C) WORD5# (D) ERROR#OVER
12. Which of the following built-in function/method 22. What does the return statement do in a function?
returns a dictionary? Explain with the help of an example.
(A) dict() (B) keys() 23. Write one example of each of the following in
(C) values() (D) items() Python:
13. Which of the following is a DML command in SQL? (i) Syntax Error
(A) UPDATE (B) CREATE
(ii) Implicit Type Conversion
(C) ALTER (D) DROP 24. Consider the following dictionaries, D and D1:
14. Which aggregate function in SQL displays the D={"Suman": 40, "Raj": 55, "Raman": 60}
number of values in the specified column ignoring D1={"Aditi": 30, "Amit":90.,"Raj":20}
the NULL values? (Answer using built-in Python functions only)
(A) len() (B) count() (i) (a) Write a statement to display/return the value
(C) number() (D) num() corresponding to the key "Raj" in the
15. In MYSQL, which type of value should not be dictionary D.
enclosed within quotation marks? OR
(A) DATE (B) VARCHAR (b) Write a statement to display the length of the
(C) FLOAT (D) CHAR dictionary D1.
(ii) (a) Write a statement to append all the key-value
16. State True or False:
pairs of the dictionary D to the dictionary

If table A has 6 rows and 3 columns, and B has 5 D1.
rows and 2 columns, the Cartesian product of A and
OR
B will have 30 rows and 5 columns.
(b) Write a statement to delete the item with the
17. Which of the following networking devices is used
given key "Amit" from the dictionary D1.
to regenerate and transmit the weakened signal
ahead? 25. What possible output from the given options is
(A) hub (B) Ethernet Card expected to be displayed when the following code is
executed?
(C) Repeater (D) Modem
import random
18. Which of the following options is the correct protocol
used for phone calls over the internet? Cards=["Heart","Spade","Club","Diamo
nd"]
(A) PPP (B) FTP
for i in range(2):
(C) HTTP (D) VoIP
print (Cards [random. randint(1,i+2)],
19. Expand ARPANET.
end="#")
Q. 20 and 21 Assertion (A) and Reason (R) based (A) Spade#Diamond# (B) Spade#Heart#
questions. Mark the correct choice as (C) Diamond#Club# (D) Heart#Spade#
(A) Both Assertion (A) and Reason (R) are True 26. The code given below accepts N as an integer
and Reason (R) is the correct explanation for argument and returns the sum of all integers from
Assertion (A). 1 to N. Observe the following code carefully and
(B) Both Assertion (A) and Reason (R) are True and rewrite it after removing all syntax and logical errors.
Reason (R) is not the correct explanation for Underline all the corrections made.
Solved Paper - 2025 3

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

else: (ii) SELECT COUNT (DISTINCT TYPE) FROM




newstr = newstr + i. WORKER;
lower() (iii) S
 ELECT MAX (WAGE), MIN (WAGE),

count+= 1 TYPE FROM WORKER GROUP BY TYPE;
newstr = newstr + mystr[:2] (iv) SELECT WNAME, SITEID FROM WORKER
print("The new string is:", newstr) WHERE TYPE="Unskilled" ORDER BY
HOURS;

ExamOn("GenX")
33. A csv file "P_record.csv" contains the record of
OR
patients in a hospital.
(b) Write the output on execution of the following
Python code: Each record of the file contains the following data:
def Change(X)"
• Name of a patient
for K,V in X. items():
• Disease
L1.append(K)
• Number of days patient is admitted
L2.append(V)
• Amount
D= {1: "ONE", 2:"TWO", 3:"THREE"} For example, a sample record of the file may be:
L1=[] ["Gunjan", "Jaundice", 4,15000]

L2=[]
Write the following Python functions to perform the
Change(D) specified operations on this file:
print(L1)
 rite a function read_data() which reads all
(i) W
print(L2) the data from the file and displays the details of
print(D) all the 'Cancer' patients.
SECTION – D  rite a function count_rec() which counts
(ii) W
and returns the number of records in the file.
32. Suman has created a table named WORKER with a
set of records to maintain the data of the construction 34. Assume that you are working in IT Department of
sites, which consists of WID, WNAME, WAGE, a Creative Art Gallary (CAG), which sells different
HOUSE, TYPE, and SITEID. After creating the forms of art creations like Paintings, Sculptures
table, sh entered data in it, which is as follows: etc. The data of Art Creations and Artists are kept
in tables Articles and Artists respectively.
WID WNAME WAGE HOURS TYPE SITEID Following are few records from these two tables:
W01 Ahmed J 1500 200 Unskilled 103 Table : Articles
W11 Naveen 520 100 Skilled 101
CODE A_Code Article DOC Price
S
PL001 A0001 Painting 2018-10-19 20000
W02 Jacob B 780 95 Unskilled 101
SC028 A0004 Sculpture 2021-01-15 16000
W15 Nihal K 560 110 Semiskilled NULL
QL005 A0003 Quilling 2024-04-24 3000
W10 Anju S 1200 130 Skilled 103
Table : Artists
(a) 
Based on the data given above, answer the
following questions: A_Code Name Phone Email DOB
(i) Write the SQL statement to display the names A0001 Roy 595923 r@CrAG.1 9 8 6 -
and wages of those workers whose wages are com 10-12
between 800 and 1500. A0002 Ghosh 1122334 g h o s h @1 9 7 2 -
(ii) Write the SQL statement to display the record CrAG.com 02-05
fo workers whose SITEID is not known. A0003 Gargi 121212 G a r g i @1 9 9 6 -
CrAG.com 03-22
 rite the SQL statement to display WNAME,
(iii) W
WAGE and HOURS of all those workers A0004 Mustafa 33333333 M f @ C r A g . 2 0 0 0 -
whose TYPE is "skilled". com 01-01
(iv) Write the SQL statement to change the Note : • The tables contain many more records than
WAGE to 1200 of the workers where the shown here.
TYPE is "Semiskilled". • DOC is Date of creations of an Article.
OR As an employee of CAG, you are required to write
(b) Considering the above given table WORKER, the SQL queries for the following:
write the output on execution of the following (i) To display all the records from the Articles
SQL commands: table in descending order of price.
(i) SELECT WNAME, WAGE*HOURS FROM (ii) To display the details of Articles which were
WORKER WHERE SITEID = 103; created in the year 2020.
Solved Paper - 2025 5

(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

City varchar (15)


Location varchar (15)
Block to Block distances(in metres):
Seats int From To Distance
Write a function Delete_Theatre(). to input
ADMIN PSYCHIATPY 65 m
ADMIN PSYCHOLOGy 65 m
the value of Th_ID from the user and permanently
ADMIN ICU 65 m
delete the corresponding record from the table.
PSYCHIATRY PSYCHOLOGY 100 m

Assume the following for Python-Database
PSYCHIATRY ICU 50 m
connectivity:
PSYCHOLOGY ICU 50 m
Host : localhoat, User : root, Password : Ex2025

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

(iii)def display_all(myStack): (iii)Describe Artists;


if myStack==[] : (iv) (a) Select t2.Name from Articles t1,
print(“Empty Stack”) Artists t2 where t1.A_Code=t2.A_Code
else: and t1.Article=”Painting”;
 p r i n t ( m y S t a c k [ : OR
:-1],sep=”®”) (b) Select t1.Name from Articles t1
NATURAL JOIN Artists t2 where
t1.Article=”Painting”;
31. (a) Output : “ The new string is : g0n2Ge
SECTION – E
OR 35. import mysql.connector
(b) [1,2,3] def Delete_Theatre():
[‘ONE’,’TWO’,’THREE’] tid=input(“Enter theatre id to delete

[{1: ‘ONE’ ,2 : ’TWO’ , 3: ’THREE’ }] :”)
32. (a) (i) Select WNAME,WAGE from WORKER con=mysql.connector.connect(user=”r
where WAGE Between 800 and 1500; oot”,password=”Ex2025”, host=”localh
ost”,database=”cinema”)
(ii) Select * from WORKER where SITEID IS cursor=con.cursor()
NULL;

sql=”Delete from Theatre where Th_
(iii) Select WName, Wage, Hours from WORK-
id=’%s’” %(tid)
ER where Type=”Skilled”;
(iv)  Update Worker Set Wage=1200 where cursor.execute(sql, (tid,))
Type=”SemiSkilled”; con.commit()
OR if cursor.rowcount > 0:
(b) (i) WNAME WAGE*HOURS
Ahmed J 300000
Anju S 156000 
print("Record deleted successfully.")
(ii)  Count(Distinct(Type)) else:
3 print("No matching record found.")
except mysql.connector.Error as err:
(iii) Max(Wage) Min(Wage) Type
print("Error:", err)
1500 780 Unskilled
1200 520 Skilled
560 560 SemiSkilled con.rollback() # Rollback changes
(iv) WNAME SITEID in case of error
Jacob B 101
Ahmed J 103 finally:
SECTION – D if cursor:
33. import csv cursor.close()
def read_data(): if con:
f=open(“P_record.csv”,”r”)
con.close()
cr=csv.reader(f)
for rec in cr : 36. import pickle
if rec[1]==”Cancer”: import os
print(rec) def Create():
f.close() pnr=input(“Enter passenger number
def count_rec(): :”)
count=0 pname= input(“Enter passenger name
f=open(“P_record.csv”,”r”) :”)
cr=csv.reader(f) brdstn= input(“Enter boarding sta-
for rec in cr : tion :”)
count+=1 destn= input(“Enter destination sta-
print(“No. of records :” ,count) tion :”)
return count fare=float(input(“Enter fare :”))
f.close() prec=[pnr,pname,brdstn,destn,fare]
34. (i) Select * from Articles order by Price
f=open(“passengers.dat”,”ab”)
desc;
(ii) Select * from Articles where year(DOC) pickle.dump(prec,f)
=2020; f.close()
Solved Paper - 2025 9
prec[4]=str(fr)
def SearchDestn(D) pickle.dump(prec,f2)
found = False except:
f=open(“passengers.dat”,”rb”) f1.close()
try: f2.close()
while True:  os.rename(“temp.
prec=pickle.load(f) dat”,”passengers.dat”)
if D==prec[3]:
print(prec) 37. (i) PSYCHIATRY : As it has the largest number of
computers.
found=True
(ii) Switch/Hub
except:
(iii) Cable Layout
if found==False:
print(“Record not found”) ADMIN PSYCHOLOGY
f.close()

def UpdateFare():
f1=open(“passengers.dat”,”rb”)
PSYCHIATRY ICU
f2=open(“temp.dat”,”wb”)
try: (iv) PSYCHIATRY : as it already hosts the server and
while True: has the most computers.
prec=pickle.load(f) (v) (a) Telnet
fr=int(prec[4]) OR
fr=fr+fr*0.05 (b) LAN

You might also like