0% found this document useful (0 votes)
818 views16 pages

Computer Science Question Paper 2024

Uploaded by

bdjsjdnxnsj
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)
818 views16 pages

Computer Science Question Paper 2024

Uploaded by

bdjsjdnxnsj
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/ 16

~-~•

Set-4
Q.P . Co de

t:~o. [ I I I I I I I I Candidates must write the Q.P. Code


on the title page of the answer-book. •

COMPUTER SCIENCE
Tim e all ow ed : 8 hou rs
Ma xim um Marks : 70

NO TE

I (I) Ple ase check tha t this question pap er•


contains 15 pri nte d pag es.
Ji
' (II) Ple ase check tha t this question pap
"'
J er contains 3_5· que stio ns.
'
:>
I •
(III ) ·Q.P. Code given on the rig ht han
d_ side of the question pap er sho uld be
wri tten
on the titl e page of the answer-book by
the candidate.

(IV) Ple ase write dow n the ser ial


num ber of the que stio n in the ans we
r-b ook
bef ore att em pti ng it.

(V) 15 min ute .tim e has bee n allo tted


to rea d thi s que stio n pap er. Th e que
stio n
pap er will be dis trib ute d at 10.15 a.m
. Fro m 10.15 a.m. to 10.30 a.m., the
can did ate s will rea d the que stio n pap
er only and will not wri te any ans we
r
on the ans we r-b ook dur ing thi s period
.

219 1 1 P.T.O.
General Instru ctions :
. (i) Please check this question paper contains 35 queS t i0 ns.
(ii) The paper is divide d into 5 Sections -A, B, C, D a nd E.
(iii) Sectio n A, consists of 18 questions (1 to 18). Each question carrie
s
1 mark.
(iv) Sectio n B, consists of 7 questions (19 to 25). Each question, carrie
s
2 marks. •
(v) Sectio n C, consists of ·5 questions (26 to 30). Each questi on carries
3 marks .
(vi) Sectio n D, consists of 2 questions (31 to 32). Each questi on carrie
s
4 marks . .
(vii) Sectio n E, consists of a questions (33 to 85). Each questi on carrie
s
5 marks .
(viii) A_ll progra ,mmin g questi ons are to be answe red using Pytho n Langu
age
only.
SECT ION- A
1. State True or False : 1
While_ defmi ng _a function in Python, the positional param eters in the
function heade r must always be writte n after the defaul t param eters.

2. The SELECT statem ent when combined with ___ _ clause , return s
records witho ut repetition.
1
(a) DISTINCT (b) DESCRIBE
(c) UNIQUE • (d) NULL

3. What will be the outpu t of the following statem ent :


1
print (16•5 /4•2/5 -8)
(a) -3.33 ·J(b) 6 ..0
(c) o. o (d) -13. 33

4. What possible outpu t from t~e given options is expected to be displa yed
when the following Pytho n code is executed ?
1
impor t random
Signa l =['RED ', 'YELLOW', 'GREEN']
for Kin range (2, 0, -1) :.
·R = rando m.ran drang e(K) •
prin t (Sign al[R] , end= '#')
(a) YELLOW # RED # (b) RED # GREEN #
(c) GREEN # RED # (d) YELLOW # GREEN #r
2191 2

,
I

tPe aggregate function which will display the cardinality of the


5. In SQL,
tabie is .,,,--- -· 1
6 tJJR () • (b) coun t(•)
(8 )
(c) avg() (d) sum(• )

6. Which protocol out of the following is used to send and receive emails over
a computer network ?
1
(a) PPP (b) HTTP
(c) FTP (d) SMTP

7. Identify the invalid Pytho n statem ent from the following:


1
(a) d = diet () . (b) e = { }
(c) f =· [] (d) g :::; diet{ }

8. Consider the statem ents given below and then choose the correct outpu t
from the given options : 1
myStr ="MI SSISS IPPI"
prin t (mySt r [: 4] +"#"_+myStr [-5:] )
(a) MISS I#SIP PI (b) MI~S #SIPf I
(c) MISS #IPPI S (d) • MISS I#IPP IS

9. Identi fy the statem ent from the following which will raise an error :
1
(a) print ("A" *3) (b) print (5*3)
(c) print ("15" + 3) (d) prin t (" 15" + "13")

10. Select the correct outpu t of the following code : 1


event ="G2 0 Pre•id ency@ 2023"
L=ev ent.s plit(' ')
print (L [ : : -2] )
(a) 'G20' (b) [, Presi dency @202 3']
(c) [ 'G20' ] (d) , Prasi dency @202 3'
2191 3 P.T.O.
t for
11. Which of the following options is the correc t unit of tneasu remen
1
netwo rk bandw idth?
(a) KB (b) Bit

(c) Hz (d) Km

1
12. Obser ve the given Pytho n code carefu lly ;
a=20
def conv art(a ):
b=20
a=a+b

conv ert(lO )
print (a)
Select the correc t outpu t from the given option s :
(a) 10 (b) 20

(c) 30 (d) Error ·

1
13. State wheth er the following statem ent is True or False :
While handling. exceptions in Pytho n, name of the excep tion has to be
compulsorily added with exce pt clause.

14• Which of the following is not a DDL comm and in ~QL ? 1


(a) DROP (b) CREATE
(c) UPDATE (d) ALTER

15. Fill in the blank : 1


.
- - - is a set of rules t h at needs to be followed by the comm unica ting
parties i d . •.
n or er to have t1on over
a network. . a successful and reliab le data comm un1ca
2191
4
I \A I I t -

i
1
. ,. the following Pyth on stat eme nt :
16 Cons1de
• ,-op en ( ' CONTENT . 'l'X'l' ' )
Which of the following is an inva lid stat eme nt
in Pyth on ?
~) F.s eek (l,O ) • (b) F.s eek (0,1 )

(c) F. seek (0, -1) (d) F. (·0, 2)•••Jc


s.
Q. 17 and 18 are ASSERTION (A) and REASONING (R) base d ques tion
Mar k the corr ect choice as
exp lana tion for (A).
(a) Both (A) and (R) are true and (R) is the corr ect
(b) Bot h (A) and (R) are true and (R) is not
the corr ect exp lana tion for
\
(A).
(c) (A) is true but (R) is false.
(d) (A) is false but (R) is true .

17. Ass erti on (A) : CSV ftle is a hum an· read


able text ftle whe re each line
som e
has a num ber· of fields, sepa rate d 'by comma. or
1
othe r delimiter.
row in a
Rea son (R) : wri tero w() met hod is used to writ e a sing le
CSVftle.

". sor t() in Pyt hon will give


18. Ass erti on (A) : The expr essi on "HELLO
an erro r. 1
Rea son (R) : sor t () does not exis t as a met hod /fun ctio
n for strin gs
in Pyth on. •

.
SEC TIO N-B
19. {A) (i) Exp and the following term s : 1+ 1= 2
XML, PPP
{ii) Give one difference betw een circ uit swit chin g and pac ket
swit chin g.
OR
(B) (i) Define the term web host ing.
(ii) Nam e any two web brow sers .
2191 5 P.T. O.
I
20. The code given below accepts five numbers and displays whether they are
even or odd: 2
,
Observe the following code carefully and rewrite it after removing all
syntax and logical errors :
Underline all the corrections made.
def BvenOd.d ()
for i in ranga(5):
nwn=int(input("E ntar a number")
i f nwn/2==0 : · ·
print ("Evan")
a1sa:
print ("Odd")
EvenOdd(f

21. (A) Write a user defined function in Python named showGrades (S)
w~ich takes the dictionary S as an argument. The dictionary,
• >

S contains Name: [Eng,Math,Scienc e] as key:va1ue p·airs. The


function displays the corresponding grade obtained by the students
according to the following grading rules : 2
Average.of Eng,Math,~cienca . Grade
>=90 ' A
<90 but >=60 B
<60 C
For example : Consider the following dictionary
S-{"ANIT":[92,86,6 4],"NAGMA":[65,42 ,43],"DAVID":[92,9 0,88l}
The output should be :
M0:'1' - B
lGQNA - C
DAVID - A
OR
2191 6

\ .
Write a user defined function in Pytho n named Puzzl e (W, N) which
(B)
takes the argum ent W as an English word and N as an integer and
return s the string where every Nth alphab et of the word Wis.replaced
with an underscore ("_" ) .
For example : if Wcontains the word "TELEVISION" and N is a, then
the function should return the string "TE_EV_SI_N". Likewise for the
word "TELEVISION" if N is 4, then the function should return
"TEL_VIS_ON".

22. Write the outpu t displayed on execution of the following Pytho n code
: 2
LS= ["HIMALAYA" , · "NILGIRI" , "ALASKA" , "ALPS"]
D={}
for Sin LS:
if len(S) %4 =
0:
D[S] len(S )
for.K in D:
print (K,D[ K], sep = "#")
23. (A) Write the Pytho n statem ent for each of the following tasks using
built-i n functions/methods only :
I

1+ 1=2
(i) To remove the item whose key is "NISHA" from a dictio nary
name d Stude nts.
For example, if the dictio nary Stude nts conta ins
{"ANI TA": 90, "NISHA": 76, "ASHA": 92 }, then after remov al
the dictio nary should contai n {"ANITA": 90, "ASHA": 92}
(ii) To displa y the numb er of occurrences of the substr ing "is" in a
string name d mess age.
For examp le if the string messa ge contai ns "This is his
book" , then the outpu t will be 3.
OR
(B) A tuple nam"ed subje ct stores the names of different subjects. Write
the Pytho n commands to convert the given .tuple to a list and
therea fter delete the last eleme nt of the list.
2191 7 P.T.O.

/1
(
med spo rt• in a M.'7sQL data base ,
24. (A) Ms. Veda crea ted a table na
.r
.~. and G name.
cont ainin g colu mns aam e_.... d , p_,.,,,. 2
- .
-V1
#
Afte r crea ting the table , she reali zed that the attri
has to be adde d. Help her to writ e a com man d to
bute , C:..tegoey
add the Ca.t. .g0 ey
colu mn. The reaf ter, writ e the com man d to inse rt the
following reco- rd
in the tabl e :
Gama_id : G42
P_A ge : Abo ve 18
G_nama : Che ss

Cat ego ry : Sen ior

OR
(B) Wri te the SQL ~ommands to perf orm the following
task s :
(i) View the list of tabl es in the data base , Exam .
(ii) View the stru ctur ~ of the tabl e, Term l .

25. Pred ict the o~tp ut o~ the following code :


2
def call on(b =20 ,a=1 0):
b=b +a
a=b -a
prin t(b, "#" ,a)
retu rn b
x-10 0
Y-200
x-.c allo n(x, y)
prin t(x," @" ,y)
y=c allo n(y)
prin t (x, "@", y)
2191
8
SECTION-C
e 0 utput on execution of the following Python code : 3
Write t b
26. oar Car Radar "
s== "iu,t:I'
x,-8·.plit ()
torWinL:
x=W. upper ()
if X X [ : : -1] :
for I in x:
print(I,end= "*")
else:
for I in W:
print (I ,4!1nd="I")
print()
27. Consider ~he table ORDERS given below and write the output of the SQL
queries that follow : 1x3 =3
ORDNO ITEM QTY RA-TE ORDATE
1001 RICE 23 120 2023-09-10
1002 PULSES 13 • 120 2023-10-18
1003 •RICE 25 110 2023.;..11-17
1004 WHEAT 28 65 2023-12-25
1005 PULSES 16 110 2024-01-15
1006 WHEAT 27 55 2024-04-15
1007 WHEAT 25 60 2024-04-30
(i) SELECT ITEM, SUM(QTY) FROM ORDERS GROUP BY ITEM;

(ii) SELECT ITEM, QTY FROM ORDERS WHERE ORDATB • BB'l'WBEN


'2023-11-01' AND ~2023-12-31 ';
(iii) SELECT ORONO, ORDATE FROM ORDERS WHERE I'l'EM • 'WHEAT'
AND RATE>=60 ; .

2191 9· P.T.O.
28. (A) Wri te a use r d e fiine d func tion in Pyt hon
. d d
natn ed sho win Lin es ()

I
whi ch rea s con e t nts of a text file nam e STO a-y • 'rXT and disp \(
lays
eve ry sen tenc e in a sep arat e line .
• •
Ass ume tha t a sen tenc e end s wit h a full st0
P (.), a que stio n mar k(? ),
or an exc lam atio n mar k(!) .
For exa mpl e, if the con tent of file STORY. TXT
is as foll ows :
Our par ent s tol d us tha t we mu
st eat veg eta b~e a to be
hea lth y. And i t tur ns out , our
par ent s wer e rig ht\ So,
wha t els e did our par ent s tel l?
The n the fun ctio n sho uld disp lay the file's con
tent as follows : •
Our par ent s tol d us tha t we mu st eat veg eta ble s to be
hea lth y.
And i t tur ns out , our par ent s we
re. rig ht!
So, wh at els e did our par ent s tel
l?
OR
(B) Wr ite a fun ctio n, c wor ds () in Pyt hon
- tha t sep ara tely cou nts and
disp lay s the num ber of upp erc ase and low erca -
se alp hab ets in a text.
file, Words . txt .

29. Con side r the tab le Pro jec ts giv en belo


w: 1 X 3:
Ta ble : Pr oje cts
l

-
1 p
id Pna me Lan gua ge Sta rtd ate
I, End dat e
P00 1 Sch ool . Ma nag eme nt
Pyt hon 202 3-0 1-1 2 202 3-0 4-0 3
Sys tem
P00 2 Ho tel Ma nag eme nt c++ 2O 22- 12- Oi 202 3-0 2-0 2
Sys tem ..

P00 3 Blo od Ban k


Pyt hon 202 3-0 2-1 1
P00 4 202 3-0 3-0 2
Pay rol l Ma nag eme nt . --
Pyt hon 202 3-0 3-1 2
Sys tem 202 3-0 6-0 2
Based on •
.
Ad the give n tabl e, wri• te SQL que ries £or th £ 11 .
(i)
d the con stra int, pri ma ry ke t · e o owi ng •
table Pro jec ts. • •
y O col um n P_ id in the existing
(ii)
To change the lang uag e to Pyt h
(iii) To delete the tabl e Pro j on of the p • . ·.
t f • ro1ect who se 1d 1s P002,
data . ec a rom M SQ L •
Y dat aba se alo ng with its
2191
10
. Jjst named Nums which contain s random integer s.
30. Conside r a ..J th
. the following user defined functions in Python and per1orm e
Write ·
•specified operatio ns on a stack named BigNum s. 3
.
(i) PUshB ig () : ·~t checks every number from the list Nums and pushes
all such number s which haye 5 or more digits into the stack,
BigNum s.

(ii) PopBig () : _It pops the number s from the stack, BigNum s and
displays them. The function should also display "Stack Empty"
when there are no more number s left in the stack.
For example: If the list Nums contain s the following data :
I
Nums = [213,1 0025,1 67,254 923,14 ,12976 53,314 98,386 ,92765 ]
Then on execution of PushB ig () , the stack BigNums should store :
.
[10025 , 254923 , 129765 3, 31498, 92765]
And on execution of P~pBig () , the follow~g out~ut should be displayed :
92765
31498
129765 3
254923
10025
Stack Empty

SECTI ON-D
31. Conside r the tables Admin and Transp ort given below : lx4=4
Tabla : Ad.min

-
Sid
S001
-
S name
Sandhy a
Addres s
-
S type
Rohini Day Boarde r
S002 Vedan shi Rohtak Day Schola r
S003 Vibhu Raj Hagar NULL
S004 Atharv a ~ampur Day Boarde r
2191 11 P.T.O.
I
Tab le: Tran sport

-
Sid
S002
-
Bua no
TSS10
Stop_name
Sara i Kale Khan
S004 TSS12 Sain ik Viha r
S005 TSS10 Kull a Hagar
Write SQL queries for the following :
(1.) n·1splay the stude nt name_ and thei·r stop name from the table s
Adm.in and Tran sport .
(ii) Display the number of stude nts whose S_ type is not known.
(iii) Dis;play a~ details of the stude nts whose name start s with 'V'

(iv) Display stude nt id and addre ss in alpha betic al order of stude
nt
name , from the table Adrni n.

32. Sang eeta is a Python programmer working in a comp uter


hard ware
company. She has to main tain the records of the perip heral devic
es. She
creat ed a csv ftle named _Per ipher al. csv, to store the detai
ls. The
struct ure. of P•rip hera l . csv is· :
[P_id ,P_na me,P rice]
wher e
P_id is Perip heral device ID (integer)
P_name is Perip heral device name (String)
Pric e is Perip heral device price (integer)

Sang eeta wants to write the following user defin ed funct ions :
Add_ Devic e () : to accept a record from _the user and add it to
a csv· file
Perip hara l.csv . • '
Coun t_Da vice () : To count and displa b .
. . Y num er of penp heral devices
whose price is less than 1000.
2191
12
SEC TION -E
. • pt Ltd. is an event mana geme nt company with its prime
office
33
• :::::: :~en galu ru. The company is planning to open its new
division at
three different locations in Chen nai n_amed as - Vajra, Tris.h
ula and
Sudershana.
1 x 5 =5•
y 0 u, as a networking exper t need to suggest solutions to the quest
ions in
part (i) to (v), keeping in ~ind the distan ces and other given parameters_
.
Bengaluru
Office

Chennai Division

Vajra Trishula

Suder shana

Dista nces betwe en various locations :


Vajra to Trish ula 350m
Trish ula to Sude rshan a 415.m
Sude rshan a to Vajra 300ni
Beng aluru Office to Chen nai 2000 km
Numb er of comp uters insta lled at vario us locations :
Vajra 120
Sude rshan a 75
Trish ula 65
Beng aluru Office 250
(i) Sugg est and draw the cable layou t to efficiently connect vario
us
locations in Chen nai division for connecting the digita l devices.
(ii) Whic h block in Chen nai division s~ould host the serve r ? Justif
y your
answ er. •
(iii) Which fast and effective wired trans missi on medium should be
used
to co~nect the prj.me office at Beng aluru with the Chen nai division
?
2191 13 P.T.O.
' ----
n

(iv) Which network device will be use


d to connect the digital devices
within each location of Ch enn ai div
ision so ·th at the y may 35.
communicate with each oth er ?
(v) A considerable am oun t of dat a
loss is noticed between different
locations of the Ch enn ai division,
which are connected in the
network. Sug ges t a networking device
tha t should be installed to
ref res h the dat a and reduce the dat a los
s dur ing tran sm issi on to and
from different locations of Ch enn ai div
ision.

34. (A) (i) Dif fer ~nt iate bet we en ' w' and ' a' file
modes in Pyt hon . 2 + 3 =t
(ii) Co nsi der a bin ary
file, ite ms .da t, con tain ing rec ord s sto
red in
the giv en for ma t :
{it em _id : [ite m_ nam e,a mo un t]}
Wr ite a function, Copy_new(), t~a
t copies all records whose
am oun t is gre ate r tha n 1000 from ite
da t. -
ms .da t to new ite ms .

OR
(B) (i) Wh at is the advantage of usi ng wi th cla
use while opening a dat a
file in Pyt hon ? Also give syn tax of wi th
clause.·
(ii) A bin ary file, EMP . DAT has the
following str uct ure :
[Emp_Id, Name, Sa lar y]
wh ere

-
Emp Id : Employee. id

Name : Employee Na me

Sa lar y : Employee Sal ary


Wr ite a use r defined function, di~ p_ De
tai l () , tha t would rea
the con ten ts of the file EMP . DAT and
dis pla y the det ails of thos
employees whose sal ary is below 250 00.
2191
14
Define cartes ian product with respec t to RDBMS. 1+4= 5
35. (A) (i)
(ii) sunil wants to write a progra m in Pytho n to updat e the
quant ity to 20 of the records whose item code is 111 in the table
named shop in MySQL datab ase named Keep er .
The table shop in MySQL contai ns the following attrib utes :
. .

-
Item code: Item code (Integer)
• Item_ name : Name of item (String)
• Qty: Quant ity of item (Integer)
• Price : Price of item (Integer)
Consider the following to establish connectivity between Python and
MySQL:
• U sernam e : admin
• Passw ord : Shopp ing.
• Host: local host
OR
(B) (i) Give any two featur es of SQL.
(ii) $umit wants to write a code in Pytho n to displa y all the detail s
of the passen gers from the ta,ble fligh t in MySQL datab ase,
Trav el. The table contai ns ~he.following attrib utes:

-
F code : Flight code (String)
'
.•

-
F name : Name of flight (String)
.
Sou~ ce : Depar ture city of flight (String)
Dest inati on: Destin ation city of flight (String)
Consi der the following to establ ish connectivity betwe en Pytho n
andM ySQL :
• Usern ame : root
• Passw ord : airpl ane
• Host : local host

2191 15
2191 16

You might also like