0% found this document useful (0 votes)
193 views15 pages

Computer Science SET 4 CBSE 2025

The document outlines a structured question paper consisting of 37 questions divided into five sections, with varying marks assigned to each section. It includes instructions for answering questions, such as using Python for programming questions and providing true/false responses. Each section focuses on different aspects of programming and SQL, testing knowledge through multiple-choice questions, coding tasks, and theoretical explanations.

Uploaded by

swastiksaha59
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)
193 views15 pages

Computer Science SET 4 CBSE 2025

The document outlines a structured question paper consisting of 37 questions divided into five sections, with varying marks assigned to each section. It includes instructions for answering questions, such as using Python for programming questions and providing true/false responses. Each section focuses on different aspects of programming and SQL, testing knowledge through multiple-choice questions, coding tasks, and theoretical explanations.

Uploaded by

swastiksaha59
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/ 15

General Instructions :

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.

The paper is divided into 5 Sections - A, B, C,


D and E.
(iii)
(iv) Section A, consists of 21 questions (1 to 21). Each question carries
Imark.
Section B, consists of 7 questions (22 to 28). Each question carries
(v)
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.

(vii) 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.

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."

1 2 What will be the output of the following statement ? 1

print (14%3**2 *4)


(A) 16 (B) 64
(C) 20 (D) 256
91 Page 3 of 32 P.T.O.
following code snippet: 1
3 Identify the correct output of the
g a m e = " O l y m p i c 2 0 2 4 "

("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

def (D) with


(C)

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)

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']

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

7 Which of the following operator evaluates to True if the variable on either


False
Side of the operator points towards the same memory location and
otherwise?
(A) is (B) is not

(C) and (D) or

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#

9. While creating a table, which constraint does not allow insertion of


duplicate values in the table? 1

(A) UNIQUE (B) DISTINCT


(C) NOT NULL (D) HAVING

10. Consider the statements given below and then choose the correct output
from the given options : 1

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$$

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 ()

13. Which of the following is a DML command in SQL? 1

(A) UPDATE (B) CREATE


(C) ALTER (D) DROP

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

(A) DATE (B) VARCHAR

(C) FLOAT (D) CHAR

16. State True or False :

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.

used to regenerate and


17. Which of the following networking devices is 1
transmit the weakened signal ahead?
(A) Hub (B) Ethernet Card

(C) Repeater (D) Modem


Page 9 of 32 P.T.0.
91
18. Which of the following options 1s the correct protocol used for phone calls
over the internet ?

(A) PPP (B) FTP


(C) HTTP (D) VoIP

19. Expand ARPANET. 1

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

Reason (R) : The pickle. dump () method is used to read from a


binary file.

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

(b) Write a statement to display the length of the dictionary D1.


pairs of the
(ii) (a) Write a statement to append all the key-value
dictionary D to the dictionary D1.
OR
"Amit"
(b) Write a statemnent to delete the item with the given key
from the dictionary Dl.

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"]

for i in range (2):


(1,i+2) ), end="#")
print (Cards [random. randint
Spade#Diamond# (B) Spade#Heart#
(A)
Diamond#club# (D) Heart#Spade#
(C)
Page l3 of 32 P.T.0.
91
26. The code given below accepts N as an integer argument and returns the
sum of 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. 2

def Sum (N)


for I in range (N) :
S=S+I

return S

print (Sum (10)

27. Nisha is assigned the task of maintaining the staff data of an


organization. She 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. 2

(1) (a) Help Nisha to identify the attribute which should be


designated as the PRIMARY KEY. Justify your answer.
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.
(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.

2
28. (a) Expand and explain the term URL.
OR

Expand the term PPP. What is the use of


PPP?
(b)
Page 15 of 32 P.T.0.
91
SECTION - C (3 x 3 = 9)
29. (a) Write a Python function that displays all the lines containing the
word vote from a text file "Elections. txt". For example, if
the file contains 3
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.
OR
(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 aa awesome able

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'.

31. (a) Predict the output of the following code:


def ExamOn (mystr):
newstr =

count = 0

for i in mystr:
i f countt2 != 0:

newstr = newstr + str (count-1)


else:

newstr = newstr + i.lower ()


Count += 1

newstr = newstr + mystr [:2]


print ("The new string is:", newstr)
ExamOn ("GenX")

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)

32. Suman has created a table named WORKER with a set of


records to
maintain 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 :
WID WNAME WAGE HOURS TYPE SITED

Ahmed J 1500 200 Unskilled 103


WO1
100 Skilled 101
W11 Naveen S 520

780 95 Unskilled 101


W02 Jacob B
110 Semiskilled NULL
W15 Nihal K 560

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.

Sculptures etc. The


sells different Department of a Creative Art
data of Art forms of art creations like Paintings,
Articles and
Artists Creations and Artists are kept in tables
these tWo tables : respectively. Following are few records from
Table 4 x 1= 4
Code IA Code I Articles
Article DOC
PLO01 A0001 Price

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

Block to Block distances (in metres):


From To Distance

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

(i) Which hardware your choice.


device
Computers within each block willof you suggest to connect all the

(ii) Draw a cable Viiayawada Center


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) 1he Manager at Nagpur wants to remotely access the
computer
in Admin block in Viiavawada. Which protocol will be
this ?
used for

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

You might also like