Computer Science SET 4 CBSE 2025
Computer Science SET 4 CBSE 2025
37 questions.
i) This question paper contains
choices have been
(i) All questions are compulsory. However, internal choices in such
provided in some questions. Attempt only one of the
questions.
(vii) Section E, consists of 2 questions (36 & 37). Each question carries
5 marks.
1)
SECTION - A (21 x 1 = 21)
1
1 State True or False :
"A Python List must always contain all its elements of same data type."
("C") )
print (game. index
0 (B) 6
(A)
(C) -1 (D) ValueError
1
4 Which of the following is the correct identifier?
(A) global (B) Break
6 Consider the statements given below and then choose the correct output
1
from the given options :
L=('TIC', TAC']
print (L[::-1] )
(A) ['CIT' ,'CAT'] (B) ['TIC', TAC']
91 Page 5 of 32 P.T.0.
Consider the statements given below and then choose the correct output
from the given options 1
D={'S01':95, 'S02' :96 )
for I in D :
print (I, end='#')
(A) SO1#s02# (B) 95#96#
(C) so1,95#S02,96# (D) So1#95#s02#96#
10. Consider the statements given below and then choose the correct output
from the given options : 1
output
11. Consider the statements given below and then choose the correct 1
from the given options:
N='5
try:
print('WORD! + N, end='#)
except:
print('ERROR',end='#')
finally:
print('oVER')
(B) WORD5 #OVER
(A) ERROR#
(D) ERROR#OVER
(C) WORD5#
Page 7 of 32 P.T.0.
91
12. Which of the following built-in function/method returns a diction ary ?
(A) dict () (B) keys ()
(C) values () (D) items ()
14. Which aggregate function in SQL displays the number of values in the
specified column ignoring the NULL values?
(A) len () (B) count ()
(C) number () (D) num ()
15. In MYSQL, which type of value should not be enclosed within quotation
marks ? 1
If table A has 6 rows and 3 columns, and table B has 5 rows and
30 rows and
2 columns, the Cartesian product of A and B will have
5 columns.
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 () method will display an error. 1
21. Assertion (A) : We can retrieve records from more than one table in
1
MYSQL.
Reason (R) Foreign key is used to establish a relationship between
two tables.
Page 1l of 32 P.T.0.
91
D
SECTION - B (7 x 2 = 14)
22. What does the return statement do in a function ? Explain with the help
2
of an example.
2
23. Write one example of each of the following in Python:
(i) Syntax Error
(ii) Implicit Type Conversion
2
24. Consider the following dictionaries, D and D1 :
D={"Suman": 40, "Raj":55, "Raman" : 60}
D1={"Aditi":30, "Amit":90, "Raj":20}
(Answer using built-in Python functions only)
corresponding to
(i) (a) Write a statement to display/return the value
the key "Raj" in the dictionary D.
OR
is expected to be displayed
25. What possible output from the given options 2
when the following code is executed
?
import random
Cards=["Heart", "Spade","Club", "Diamond"]
return S
2
28. (a) Expand and explain the term URL.
OR
30. (a) A stack, named Clrstack, contains records of some colors. Each
record is represented as a tuple containing four elements
ColorName, RED, 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) 3 x 1=3
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.
(Gi) 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.
OR
91
Page 17 of 32 P.T.0.
(b) Write the following user-defined
functions in Python:
(1) Push_trail
(N, myStack): Here N and mystack are lists,
and
mystack represents a stack. The function should
5 elemnents from the list N push the last
onto the stack myStack. For
example, if the list N is [1,2,3,4,5,6,7,then the
push trail () should push the elements function
stack. Therefore the value of stack will be 3,4,5,6,7 onto the
[3,4,5,6,7].
Assume that N contains at least 5
elements.
(1) poP_one (myStack) : The function should
pop an element
from the stack myStack, and return this element.
If the stack
1s empty, then the function should display the
message 'Stack
Underflow', and return None.
(1i1) 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'.
count = 0
for i in mystr:
i f countt2 != 0:
OR
91 Page 19 of 32 P.T.0.
Write the output on
execution of the following Python code:
def Change (X) :
for K,V in
X.items ():
LI. append (K)
L2. append (V)
D={1: "ONE",2:"TWO",3: "THREE"}
Ll=(]
L2= []
Change (D)
print (Ll)
print (L2)
print (D)
)
SECTION - D (4 x 4 = 16)
Skilled 103
1200 130
W10 Anju S
Page 21 of 32 P.T.0.
Based on the
(a) data
given above,
(i) Write the SQL answer the folllowing questions :
those workers statement to
whose wages aredisplay the names and wages of
(i) Write the SQL between 800 and 1500
whose SITEID is statement to
not known. display the record of workers
(iii) Write the SQL
all those statement to display WNAME, WAGE and HOURS of
workers whose TYPE
(iv) Write the SQL is 'Skilled'.
workers where thestatement
TYPE is
to change the WAGE to 1200 of the
"Semiskilled".
OR
(b) Considering the above given table wORKER..,
execution of the following SQL write the output on
i) SELECT
commands :
WNAME, WAGE*HOURS FROM
SITEID = 103: WORKER WHERE
(ii) SELECT COUNT (DISTINCT TYPE) FROM WORKER,
(iii) sELECT MAX (WAGE), MIN (WAGE) TYPE FROM WORKER
GROUP BY TYPE;
(iv) SELECT WNAME, SITEID FROM WORKER WHERE
TYPE="Unskilled" ORDER BY HOURS;
33. A csv file "P record. csv" contains the records of patients in a hospital.
4
Each record of the file contains the following data:
Name of a patient
Disease
admitted
Number of days patient is
Amount
sample record of the file may be :
tor example, a
T"Gunjan", "Jaundice",4,15000]
specified operations
functions to perform the
Python
Write the following the
on this file : reads all the data from
which
function read data () 'Cancer'
patients.
Write a
the details
of all the counts and returns the
displays which
ile and count rec ()
function
(i) Write a the file. P.T.O.
records in
number of of32
P a g e 23
Assume that
you are
Gallery (CAG), which working in the IT
34.
SC028 i A0004
Painting 2018-10-19 20000
QLO05 ! A0003
Sculpture 2021-01-15 16000
gu1111ng 2024-04-24 ! 3000
Table : Artists
A_Code Name Phone
+ Email DOB
A0001 Roy | 595923
A0002
c@CrAG. com |1986-10-12
Ghosh I1122334
A0003
ghosh@CrAG. com 1972-02-05 I
Gargi 121212
Gargi@CrAG. com 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.
(i) To display the details of Articles which were created in the vear
2020.
(i) 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.
Page 25 of 32 P.T.0.
35. Atable, named THEATRE, in cINEMA database.
has the following structure: 4
Field
Type
Th ID
char (5)
|Name
Ivarchar (15)
City varchar (15)
LOcation varchar (15)
| Seats int
Write a function Delete Theatre (U). to input the
value of Th_ID rom
the user and permanently delete the corresponding
record from the table.
Assume the following for Python-Database
Host : 1localhost, User:root,
connectivity :
Password : Ex2025
SECTION - E (2 x 5 = 10)
36. A file, PASSENGERS.DAT, stores the records of passengers using the
following structure: 5
[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 :
Create () - to input data for passengers and write it in the binarv
file PASSENGERS.DAT.
(ii) SearchDestn (D) to read contents from the file pPASSENGERS. DAT
and display the details of those Passengers whose DESTN matches
with the value of D.
(iüi) TodateFare ()- to increase the lare of all passengers by 5% and
rewrite the updated records into the file PASSENGERS.DAT
Page 27 of 32
91 P.T.0.
37. Swabhaav is a big NGO working
and Counselling,
in the field of Psychological Treatment
having its Head Office in Nagpur. It is planning to set
up a center in Vyayawada. The Viiavawada Center will have four blocks -
ADMIN, PSYCHIATRY, PSYCHOLOGY, and ICU. You, as a
Expert, need to Suggest the best network-related solutions for NetwoTk
resolve the issues/problems mentioned in them to
guestions (i) to (v), keeping the
following parameters in mind: 5x1= 5
ADMIN PSYCHOLOGY
Block
Block
Vijayawada Center.
PSYCHIATRY ICU
Block Block
ADMIN PSYCHIATRY 65 m
PSYCHOLOGY 65 m
ADMIN
ICU 65 m
ADMIN
PSYCHOLOGY 100 mn
PSYCHIATRY
50 m
PSYCHIATRY ICU
ICU
50 m
PSYCHOLOGY
Center = 700 km
Nagpur Head Office from Vijayawada
Distance of :
Computers in each
block is as follows
Number of
of Computers
No
Block
16
ADMIN
40
PSYCHIATRY
19
PSYCHOLOGY
20
P.T.0.
ICU Page 29 of
32
91
() Suggest the most
appropriate location of the server inside
Vijayawada Center. Justify the
OR
(b) Which type of Network (PAN, LAN, MAN or WAN) will be set
up among the computers connected with Vijayawada Center ?
Page 31 of 32
91