0% found this document useful (0 votes)
18 views8 pages

Practice SAMPLE PAPER 1 Comp Sci_124619

This document is a sample question paper for Computer Science for 12th grade, containing 37 questions divided into five sections with varying marks. It includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python. The paper emphasizes the importance of understanding programming concepts and data structures, with a total maximum score of 70 marks and a time limit of 3 hours.

Uploaded by

kumharsh110
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)
18 views8 pages

Practice SAMPLE PAPER 1 Comp Sci_124619

This document is a sample question paper for Computer Science for 12th grade, containing 37 questions divided into five sections with varying marks. It includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python. The paper emphasizes the importance of understanding programming concepts and data structures, with a total maximum score of 70 marks and a time limit of 3 hours.

Uploaded by

kumharsh110
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/ 8

--SOP Code: PB-3/15 I Series i-Succeed 3-25/15 Roll No.

IIII IIIJ
-
Sample Question Paper 03
Computer Science 12th (Code 083)
6eneral Instructions
1. This question paper contains 37 questions.
2. All questi~ns are compulsory. However, internal choices have been provided in
some questions. Attempt only one of the choices in such questions.
3. The paper is divided into 5 Sections - A, B, C, D and E. Time: 3 Hrs.
4. Section A, consists of 21 questions (1 to 21). Each question carries 1 Mark.
S. Section B, consists of 7 questions (22 to 28). Each question carries 2 Marks. Max. Marks : 70
6. Section C, consists of 3 questions (29 to 31). Each question carries 3 Marks.
7. Section D, consists of 4 questions (32 to 35). Each question carries 4 Marks.
8. Section E, consists of 2 questions (36 to 37). Each question carries 5 Marks.
9. All programming questions are to_ be answered using Python Language only.
10. In case of MCQ text of the correct answer should also be written.

Section A [21xlx21]

1. State True or False


The keys of a dictionary are mutable.
I ' I, ' I

2. Given an object objl= (10, 20, 30, 40, SO, 60, 70, 80, 90). What will be the output of print(obj1[3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70) (c) (40,50,60) (d) (40,60)
.

3. Which of the following expressions results in an error?


(a) float('12') ' (b) int('12') (c) float('12.q') (d) int('12.5')

4. Given sl="Olympics@France". What will be the output of s1[2: -3:2]


(a) 'y®r' (b) 'pc@r' (c) 'ypc@r' (d) None of these

5. ~twill be the output of the following code snippet?


Str = "KENDRIYA VIDYALAYA SANGATHAN JAMMU REGION"
, I
Str = Str.split()
NewStr = Str[OJ + "#" + Str[l] + "#" + Str[ 4J
print (NewStr)
6. Evaluate the following' expression and identify the correct answer.
16 - (4 + 2) * 5 + 2**3 * 4
(a) 54 (b) 46 (c) 18 (d) 32
7 • The output produced by following code is:
try:
x-17
y-18
p•(x+y)%6 + y//5
except:
print("Error in execution")
else:
print("No errors")
finally:
print("Code executed")
8. Which among the following data structures can be edit ?
(a) {} (b)[ 1 (c) () (d) Both (a) and
(b)
9. Write the output of the following:
def cal (m. n):
if m == n:
return m * 3
else:
return n * 2
s = ca 1 C Amit
II
Anuj
11

11 11
)

print(s)
(a) AmitAmitAmit (b) AmitAmit (c) AnujAnujAnuj (d) AnujAnuj
10. Write the missing statement to open the file such that the data record is appended to the
file. ·'
import pickle
f•open("abc.dat" . __ )
pickle.dump([roll.name.marks].f)
f .close()
11. State True or False : It is must to handle exception in ~y code.
12. Identify the output of the following Python statement.
SP-03 lstl = [10. 15. 20. 25. 30] J
lstl.insert( 3. 4)
lstl.insert( 2. 3)
print (lstl[-5])
W2 M3 W4 (d) 20
13. . ........... is an attribute that makes a link between two tables to fetch corresponding
data.
(a) Primary key (b) Secondary key
(c) Foreign key (d) Composite key
l

14. What will the following query do?


Delete from Books where Bookname like "r_U":
(a) Displays details of books whose names starts with "r and has 3rd letter as t
11 11 11

(b) Removes records of books whose names starts with "r and has 3rd letter as "t"
11

(c) Removes records of books whose names starts with r11 11


(d) None of the above


sample Question Paper 03 49

15. Which of the following functions returns a part of a string


w~~ .
(c) substring() (b) midQ
(d) Both a) and (b)
16. The ••••••••••••.. ••• clause can match a range of values in a field.
(a) range
(b) order
(c) between
(d) between values
• used popular1y for v1'deo
• · protocol that 1s
. ,following is the commurucation
17. Which of the
conferencmg.
(a) HTTP (b) SGML (c) VoIP (d) HTIPS
18. Which among the following is n<;>t a protocol.
(a) TCP (b) PPP (c) SGML. (d) HTIPS

What type of network topology has all devices connected to a central hub or switch?

Directions (Q. 20 and 21) are Assertion (A) and Reason (R) based questions. Mark the
correct , ·,
,
choice as
(a) Both A and Rare true and R is a correct explanation of A.
(b) Both A and Rare true but R is not a correct explanation of A.
(c) A is true and R is false.
(d) A is false and R is true.
20. Assertion (A) Built-in functions are predefined in the system and can be directly used in
any program.
Reason (R) id() and type() are built-in functions in Python.
21. Assertion (A) The cardinality of a table can be increased by adding fields to the table.
Reason (R) Cardinality is number of records, adding fields will increase the degree.

Section B [7X2=14]

22. , (i) Suppose there is a list such that: L=[2,3,4]. If we want to print this list in reverse order SP-03
with an output of L=[4,3,2], which function/method should be used?
(ii) Which clause can sort a list in descending order. •

23. Give two examples each of membership and identity operators


24. Given Empdict={"Eno": "E00l","Ename":"Jack","Dept":"Accts"} •
(I) (a) Write a statement to add the salary as 15000 into the dictionary.
Or
(b) Write a statement to modify the "Ename" to "Ananya".
(Il) (a) Write a statement to display the keys of the dictionary.
Or
(b) Write a statement to remove the key: value pair of "Dept"
SO i Succeed Computer Scien
rr=============--=--=--=--=--=--=--=-=-=-=--==--==--==-==-==-==-::::::::::::::::===-==-==-==-=-=-=-=-=-:::::~
25 Wh th fOllowing code ? Also specify th
• ~tare the possible outcome(s) executed fro~ e 'able PICKER. e
maximum and minimum values that can be assigned to van
import random
PICKER= random.randint(O. 3)
COLOR= ["BLUE", "PINK". "GREEN". "RED"]
for I in COLOR:
for Jin range (1. PICKER):
print (I. end="")
print ()
PINK BLUEBLUE
(a) BLUE BLUE
PINKGREEN pJNKPINI<
(b) PINK BLUEPINK
GREENRED GREENGREEN
(c) GREEN BLUEPINKGREEN
REDRED
(d) RED BLUEPINKGREENRED II
26. Which constraint will restrict duplicate values in a field of a table? Which constraint
allows to provide business conditions in a field?
27. (I) A table CUSTOMER has 10 columns but no row. Later, 10 new rows are inserted and3
rows are deleted in the table. What is the degree and cardinality of the table CUSTOMER?
(a) What is the degree of the table CUSTOMER?
Or
(b) What is the cardinality of the table CUSTOMER?
(II) Observe the table CLUB given below: A

Address Age Fee


Member_lD Member_Name
New Delhi 20 2000
MOOOl Sumit
Gurgaon 19 3500
M0002 Nisha '
Niharika New Delhi 21 2100
M0003
Sachin Faridabad 18 3500
M0004
(a) What is the cardinality and degree of the given table?
Or
(b) If a new column ContactNo is added and three more members join the club then how
SP-03 these changes will affect the degree and cardinality of the table.
28. (a) Expand the following terms:
MAN,FTP
Or
(b) Name two switching techniques used to transfer data between two terminals(computers).

Section C [3x3=9]

29. Write a function countEU() in Python, which should read each character of a text file
IMP.TXT should count and display occurrence of alphabets E and U (including small cases
e and u too). I •
e.g. If the file content is as follows :
Pinaky has gone to his friend's house.
His friend's name is Ravya. Her house is 12 km from Pinaky's house.
The countEU() function should display the output as
E: 8, U: 3


-
Write a Pyth on prog ram to find th Or ·
statu s.txt are e longest word in file "status.bet". If conte nts of
Welcome to your one-s tep sol ti
various c?mp etitiv e and re~ ~: for all _yo~
study, practice and asses smen t need for
work ing tirele ssly for over ad d nt examinatio
ns and school segm ent. We have been
because you deser ve SUC CES ;~~ ~~~ re that
you have best in class study r~sou rces
outp ut shou ld be : G LESS ...
Longest word : exam inatio ns
30, (A) Julie has creat ed a dictio na . .
6 stude nts. Write a pro ramry c~nta inmg name s and •
mark s as key value pairs of
follo wing opera tions g ' wi th separ ate user defin ed funct ions to perfo rm the
Push the keys (nam e of the tud
d. s •
ent) of the dictio nary into a stack
corre spon mg va1ue (mark s) is great er than 75. , wher e the
Pop and displ ay the conte nt of the stack.

For exam ple If the samp le conte nt of th d. ti
"
e 1c onary 1s . f
11 "

R={ OM :76, JAi :45, "BOB":89, "ALI":65, "ANU


11
as o11ows
":90, "TOM":82}
The outp ut from the prog ram shou ld be
TOM ANU BOB OM

Or .
(B) Write a Pyth on prog ram to inpu t as many numb
ers and push them to a stack
perfe ctsta ck[] using a funct ion push perfe ct(), only
if the numb er inpu t is a perfe ct.
(A perfe ct num ber is one whos e sum of factors other
than itself , is equa l to the
numb er) , •
31. Cons ider the table MOVIEDETAILS given
below · [1 x3= 3]
Table : MOVIEDETAILS
MOVIEID TITLE LANGUAGE RATING PLATFORM
MOOl Mina ri Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
MOlO Kaagaz Hindi 3 ZeeS
SP-03
MOll Harry Potte r and the English 4 Prime Video
Chamber of Secrets
MOlS Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotst ar

(A) Write state men ts to:


(i) Delete the records whose language is "English"·
..
• (u) Add a new record : "M0S0", "Palki".'"Hindi", 5,"Amazon Prime".
(iii) Add a new colu mn "DAYS" of type integer.
(B) (i) Remove the colu mn "RATING". d "H t tar"
(ii) Disp lay Title and lang uage of ~ovi es playe on
o s_ .•.
... ) Increas e
(111 • f "Hi'ndi'" mov ies by 2.
ratin g o
Section D
32. (A) (i) Differ entiat e else and excep t blocks in excep tion handl ing.
ts. Repor t an error if th .
(ii) Write a code to open a file readm e. txt and print all its conten e8ie
doesn 't exist.
Or
(B) (i) When is a ValueError excep tion raised in Pytho n.
(ii) Is it comp ulsory to write the finally block in excep tion
handl ing.
of miscellaneous
33. Mr. Roy is a progr amme r at Kolka taSup pliers that maint ain inven tory
produ cts.
:
He is assign ed to write a progr am using follow ing functi ons
tory record s and st0re them to th
(I) getfuv entory () Write code to accep t as many inven e
ing struct ure
csv file Inven tory.c sv storin g record s of inven tory as per follow
PCod e Invna me Price Reord er
(IT) Displ ay() To displa y the detail s stored in Inven tory.c sv
izatio n,
34. Sarm an maint ains the follow ing tables GARM ENT and FABRIC, for his organ
SQL comm ands for the
storin g detail s of garme nts and the fabric used in them . Write
'
statem ents (i) to (iv) to meet the follow ing requir emen ts :
TABLE: GARM ENT
FCODE READYDATE
GCODE DESCRIPTION PRICE
F03 19-DEC-08
10023 PENC IL SKIRT 1150
F01 12-JAN-08
10001 FORM AL SHIRT 1250
1550 F02 06-JUN-08
10012 INFOR MAL SHIRT
F03 07-APR-07
10024 BABY TOP 750
850 F02 31-MAR-07
10090 TULIP S.KIRT
850 F03 06-JUN-08
10019 EVENING GOWN
1500 F02 20-0C f-08
10009 INFOR MAL PANT
1350 F0l 09-MAR-08
10007 FORM AL PANT
850 . F04 09-SEP-07
10020 FROCK
750 F03 20-0C f-08
10089 SLACKS

TABLE: FABR IC
FCODE lYPE
F04 POL vsijt~ ,·
F02 COTTON ' ', ,
SILK
'\
F03
F0l TERELENE

(i) To displa y GCODE and DESCRIPTION of each G tjfu~~T


GCODE. 1· .•
I • . ,\''.~·
'°~,
in desce ~ding order of
,
.
YDAT in between
E
(ii) To displa y the details of ~I ~: q~RMENTs, whichthav~ READ
08-DEC-07 and 16-]UN-08 (inclu si\e of both the da~es). • '\2', . ,
h a~~,-~ade ~p of FABRIC
(iii) T~ displa y the average PRICE of'all the GAR MEN i. Whic i ·:·i'
w1thF COD EasF0 3. , \
/~. •:·'
\
• '

' .
II

I

\
.I

53
sample Question Paper 03

(iv) (A) To display details of all garments in descending order of Readydate.

(B) To display Fcode wise number oforgarments.


35. Consider the table Student whose fields are .
~

Scode Name Age Strede Points Grade


101 Amit 16 1 6 NULL
102 Atjun 13 3 4 NULL
103 Zaheer 14 2 1 NULL
104 Gagan 15 5 2 NULL
105 Kumar 13 6 8 NULL
8
Write_ the Python code to update grade to 'A' for all these students who are getting more than
as points.
The table structure is as follows :
Scode : integer
Name : varchar
Age : integer
Strede : integer
Points : integer
Grade : varchar
Note the following to establish the connection between Python and MySQL:
Host : localhost
Usemame : Admin
Password : Admin@l23
The table exists in MySQL database as : Student
' ,.
Section E , , [2x5=10]

36. Mr. Reena is a developer in file handling and has to write certain functions on csv files.
She is confused with certain queries regarding the file type and the code writing. Help he SP-03
in writing the code and in her queries.
(i) When do we use CSV file?
(ii) Write a program using two functions :
addCustom er() To write Customer code, Customer name and Amt in file "cust.csv"
The details of the customers are as follows :
[ 'CustCod e', 'CustName', 'Amount' J
['001', 'Nihir', '8000'] <

['104', 'Akshay', '5000']


readCusto mer() To read the details of the custo_mers and display them.
37• R~d Pandas Infosystems has its 4 blocks of buildings. The number of computers and
diSt ances among them is given below :

Building Number of Computers


HR 15
AD:tvnN 100
SYSTEM 25
PERS 30

Building Distance
HR-Adrnin . 10m
HR-System 50m
. 750m
HR-Pers
Adrnin- System 300m

Adrnin- Pers 20m


System-Pers 250m ,.

Answer the following questions with respect to the above :


(i) Suggest a suitable cable layout for the network.
(ii) Suggest the best place to house the server of the network.
(iii) Which topology should be used to connect computers in each building?
SP -03 (iv) What kind of network will be formed here? (LAN/MAN/WAN)
(v) Write one advantage of the topology suggested by you.
Or
Write one disadvantage of the topology suggested by you.

l '

You might also like