Professional Documents
Culture Documents
GeneralInstructions;
) This question paper contains five sections, Section A to E.
(i) All questions are compulsory.
öi) Section A have 18 questions carrying 1 mark each.
(in) Section Bhas 7 Very Short Answer type questions carrying 2 marks each.
in) Section C has 5 Short Answer type questions carrying 3 marks each.
(m) Section D has 3 Long Answer type questions carrying 5 marks each.
(oi) Section Ehas 2questions carrying 4marks each. One internal choice is given is Q.34 and 35, against Part (i) only.
(vi) All programming questions are to be ansuered using Python Language only.
"This Rrper is solely for reference purpose. The patern of the paper has been changed for 2024 Exam which is been followed in subscoquent Sample fupers.
SECTION -A
1. State True of False.
"Identifiers are names used to identify a variable, function in a program".
Ans.e
2. Which of the following is a valid keyword in Python?
(a) false (b) return
(c) nonlocal (d) none
Ans. C) ctun
3. Given the following Tuple
Tup= (10, 20, 30, 50)
Which of the following statements will result in an error?
(a) print (Tup [0]) (b) Tup.insert (2,3)
(c) print (Tup [1:2]) (d) print (len (Tup) )
Tue Fale
Te
OswaalCBSE Sample Question Papers, COMPUTER SCIENCE, Class-XIl
16
of the code:
5. Select the correct output @ 75"
S "Amrit Mahot sav
A=S.partition (" ")
print (A)
(a ('Amrit Mahotsav', '0,75) (b) 'Amrit', 'Mahotsav', '',751
('Amrit', 'Mahotsav @ 75') (d) ('Amrit',
(c) ,'Mahotsav@ 75')
Ans.
6Which of the following mode keeps the file offset position at the end of the file?
(a) r+ (b) r
(c) w (d) a
Ans.
Ans.
9. Which of the following statemernt(s) would give an error after executing the following code?
stud={"Murugan" :100, "Mithu" :95} # Statement 1
print (stud [95] ) # Statement 2
Stud ("Murugan"]=99 # Statement 3
print (Stud. pop (0) # Statement 4
print (Stud) # Statement 5
(a) Statement 2 (b) Statement 3
(c) Statement 4 (d) Statement 2 and 4
Ans.
Ans.
a list?
15. Which function returns the sum of all elements of
(a) count () (b) sum ()
total ()
(d) add ()
(c)
Ans. ) SUm()
ina result set and returns a:
16. Fetchall) method fetches all rows (b) List of tuples
(a) Tuple of lists
List of strings (d) Tuple of strings
(c)
Ans.
REASONING (R) based questions.
0.17 and 18 are ASSERTION (A)and
Mark the correct choice as
(A) and (R) are true and (R) is the correct explanation for (A).
(a) Both correct explanation for (A).
are true and (R) is not the
(b) Both (A) and (R)
false.
(c) (A) is true but (R) is
(d) (A) is false but (R) is true. particular module, we need to import the
module.
module.
17. Assertion (A): To use a
function from a
anywhere in the program, before using a function from that
be written
Reason (R): import statement can
Ans.
existing
18. Assertion (A): Astack
is aLIFO structure.
always gets positioned at the index after the last
pushed into the stack
Reason (R): Any new element
element in the stack.
Ans.
Hutnn Max
20. (a) Differentiate between wired and wireless transmission.
OR
(b) Differentiate between URL and domain name with the help of an appropriate example.
Ans.
Wixae)
fhuical akal oud CallesNo angilla nnedeial
22. Explain the concept of "Alternate Key' in aRelational Database Management System with an approprate eanp)
Ans.
key ae called altenate heys
ZI| Madhav 29 M
23. (a) Write the full forms of the following:
(i) HTML
(i) TCP
(b) What is the need of Protocols?
Ans.
a
Solved Paper 2023 19
25. (a) Differentiate between CHAR and VARCHAR data types in SQL with appropriate example.
OR
(b) Name any twoDDL and any two DML commands.
Table: BORROWER
CUST NAME LOAN NO
JOHN L-171
KRISH L-230
RAVYA L-170
How many rows and columns willbe there in the natural join of these two tables?
OR
(b) Write the output of the queries (i) to (iv) based on the table, WORKER given below:
TABLE:WORKER
W ID F_NAME L NAME CITY STATE
102 SAHIL KHAN KANPUR UTTAR PRADESH
Question Papers,
COMPUTERSCIENCE, Class-XII
20 OswaalCBSE Sample
ROOP NAGAR PUNJAB
SAMEER PARIKH
104
DELHI DELHI
MARY JONES HARYANA
105 SONIPAT
MAHIR SHARMA
106
DELHI
DELHI
107 ATHARVA BHARDWAJ
UTTAR PRADESH
SHARMA KANPUR
108 VEDA
ORDER BY STATE DESC;
(i) SELECT F NAME, CITY FROM WORKER
(i) SELECT DISTINCT (CITY) FROM WORKER; HA%;
L NAME LIKE
(ii) SELECT F NAME, STATE FORM WORKER WHERE
(iv) SELECT CITY, COUNT(*) FORM WORKER GROUP BY CITY;
Ans.
Natoral jsin adwhen ouly comneiels
ae displayed
ence 2 ou and 4 colune.
27. (a) named definition of a Python function named LongLines () which reads the contents
Write the' LINES atext
. TXT' and displays those lines from the file which have at least 10 words in it
For example, if the content of 'LINES.TXT' is as follows:
Once upon a time, there was a woodcutter
He lived in a little house in a beautiful, green wood.
One day, he was merrily chopping some wood.
He saw alittle girl skipping through the woods, whistling happily.
The girl was followed by abig gray wolf.
Then the function should display output as:
He lives in a little house in a beautiful, green wood.
He saw alittle girl skipping through the woods,whistling happily.
OR
(b Write afunction count Dwords () in Python to count the words ending with adigit in atext file "Deta: 2
txt"
Example:
If the file content is as follows:
Ans.
def Louglines():
opeuLINEStxt"")
L= xeadlinael)
y=X Split(.
pit(x
28. (a) Write the outputs of the SQL queries (i) to (iv) based on the
Table:COMPUTER relations COMPUTER and SALES given beo
PROD ID PROD NAME PRICE COMPANY TYPE
PO01 MOUSE 200
PO02 LOGITECH INPUT
LASER PRINTER 4000 CANON OUTPUT
PO03
PO04
KEYBOARD 500 LOGITECH INPUT
JOYSTICK 1000 IBALL INPUT
PO05
PO06
SPEAKER 1200 CREATIVE OUTPUT
DESKJET PRINTER 4300 CANON OUTPUT
Table: SALES
PROD ID OTY SOLD
PO02 QUARTER
4 1
PO03 2 2
PO01
PO04 2
Solved Paper 2023 21
PROD_NAME CoMNYQUARTER
LOGITECH 2
moUsE
LASER PRINTER CANON
KEYBOARD LOGIECH 2
IeAL 1
DYSTCKk
SEAKER CREATIVE NULL
DESKSET fRINTER CANON NULL
SHoW DATABASES
Thereafter, it increments all even
Write a functions EOReplace () in Python, which accepts a list L of numbers.
29. numbers by 1.
numbers by 1 and decrements all odd
Example:
If Sample Input data of the list is:
L= (10, 20, 30, 40, 35, 55)
Output will be:
L=(11,21, 31, 41,34, 54)
Ans
del EoReglaca ():
x in L:
Lot ifx2=50:
LIL.indexC07 +=1
DL[L.index)-=1
iut ("L="
EoRaplaca ()
22 Oswaal CBSE Sample Question Papers, COMPUTER SCIENCE, Class XII
Branch B 25
Branch C 40
Branch D 115
Delhi branch with a suitable reason.
(1) Suggest the most suitable place to install the server for the
within Delhi.
(ii) Suggest an ideal layout for connecting all these branches
placed in each of these branches to efficiently connect all the
(ii) Which devices will you suggest, that should be
computers within these branches?
to its Marketing department in Kanpur whichyour is approximately 300 km
(iv) Delhi firm is planning toconnect of formed? Justify answer.
away. Which type of network out LAN, WAN or MAN will be between Delhi and Kanpur
help for transferring of files
(v) Suggest a protocol that shall be needed to provide
branch.
Ans.
installe as it has the naaximunm number of
Canneuters
Sunch c)
BenchA)
i ) Hub
iv) wie Aea_Nehek CwA weeld Re used
newstr=newstrtstr (count)
else:
if i.lower ():
newstr=newstrti.upper ()
else:
newstr=newstr+i
Countt=1
print (newstr)
makenew ("No@1")
The code given below
reads the
who have employees
E code - coming fromfollowing records from the table employee andI displays onlythosered
city Delhi:
E
String
name - String
Sal - Integer
City - String
Note the following to
"
Username is root establish connectivity between Python and MySQL:
"
Password is root
The table exists in a
" The details (E MySQL database named emp.
code,E name, Sal, (City) ) are the
attributes of the table.
Solved Paper-2023 25
nAydl.coitC)
33. (a) Write one difference between CSV and text files.
functions:
Write a program in Python that defines and calls the following user defined
csv'.
(i) cOURIER ADD () : It takes the values from the user and adds the details to a csv file courier.
Each record consists of a list with field elements as cid, s name, Source, destination to store
Courier ID, Sender name, Source and destination address respectively.
going to
(ii) coURIER SEARCH () : Takes the destination as the input and displays all the courier records
that destination.
ORM
(b) Why is important to close a file before exiting? functions:
Write a program in Python that defines and calls the following user defined consists
(i) Add Book() : Takes the details of the books and adds them to a csv file 'Book.csv'. Each record
of a list with field elements as book ID, B name and pub to store book ID, book name and publisher
respectively.
(ii) Search Book() : Takes publisher name as input and counts and displays number of books published by
them.
Ans.
and colMns whichs notth cala in a
g2netic Ctxt) le ssence bata modifcaton
and stoage much mate
smpot csV.
oith open C' cousinbe csy", w, nawline) f
COMPUTER SCIENCE, Class-XII
OswaalCBSE SampleQuestion Papers,
26
wkile caprel :
Manme
S.naa inpot ("lr eude
SKC Mput ("atr Sotce )
Ans. 33aD
del coUkIEK SEARCH () :
CoURIER- ADb()
CoORIER SEARCH )
SECTION -E
34. The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Kanu
created a table and entered data of 5 labs.
LABNO LAB NAME INCHARGE CAPACITY FLOOR
Solved Paper-2023 27
(a) Add a constraint PRIMARY KEY to the column LABNO in the table.
(b) Delete the table LAB,
ns.
while true:
c no=int (input ("enter customer number") )
Cname=input ("enter customer name")
qty=int (input ("enter qty") )
price=int (input ("enter price"))
if # Statement 2
print ("Quantity less than 10.. Cannot SAVE")
else:
amt=price * qty
c detail= [c no, c name, qty, price,amt]
# Statement 4
# Statement 5
#Statement 6
Write the correct statement to open afile 'Cust file .dat ' for writing the data of the custome.
(i)
(iü) Which statement should Shreyas fillin Statement 2 to check whether quantity is less than 10.
(iüü) Which statement should Shreyas fill in Statement 3 to write data to the binary file and in Statement 4 to stop
further processing if the user does not wish toenter more records.
OR
(Option for part (ii) only)
(ii) What should Shreyas fill in Statement 5 to close the binary file named Cust file . dat and in Statement 6
tocall a function to write data in binary file?
Ans.