CBSE Board QP
CBSE Board QP
CBSE Board QP
91/C
Candidates must write the Code on the
Roll No.
title page of the answer-book.
General Instructions :
.91/D 1 P.T.O.
SECTION A
1. (a) Which of the following is not a valid variable name in Python ?
Justify reason for it not being a valid name. 1
(i) 5Radius
(ii) Radius_
(iii) _Radius
(iv) Radius
(b) Which of the following are keywords in Python ? 1
(i) break
(ii) check
(iii) range
(iv) while
(c) Name the Python Library modules which need to be imported to
invoke the following functions : 1
(i) cos()
(ii) randint()
(d) Rewrite the following code in Python after removing all syntax
error(s). Underline each correction done in the code. 2
input('Enter a word',W)
if W = 'Hello'
print('Ok')
else:
print('Not Ok')
(e) Find and write the output of the following Python code : 2
def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i] //= 5
if M[i]%3 == 0:
M[i] //= 3
L=[25,8,75,12]
ChangeVal(L,4)
for i in L :
print(i, end='#')
.91/D 2
(f) Find and write the output of the following Python code : 3
def Call(P=40,Q=20):
P=P+Q
Q=P–Q
print(P,'@',Q)
return P
R=200
S=100
R=Call(R,S)
print (R,'@',S)
S=Call(S)
print(R,'@',S)
Colours = ["VIOLET","INDIGO","BLUE","GREEN",
"YELLOW","ORANGE","RED"]
End = randrange(2)+3
Begin = randrange(End)+1
for i in range(Begin,End):
print(Colours[i],end="&")
(i) INDIGO&BLUE&GREEN& (ii) VIOLET&INDIGO&BLUE&
(iii) BLUE&GREEN&YELLOW& (iv) GREEN&YELLOW&ORANGE&
2. (a) Write the names of the immutable data objects from the following : 1
(i) List
(ii) Tuple
(iii) String
(iv) Dictionary
.91/D 3 P.T.O.
(b) Write a Python statement to declare a Dictionary named ClassRoll
with Keys as 1, 2, 3 and corresponding values as 'Reena',
'Rakesh', 'Zareen' respectively. 1
(c) Which of the options out of (i) to (iv) is the correct data type for the
variable Vowels as defined in the following Python statement ? 1
Vowels = ('A', 'E', 'I', 'O', 'U')
(i) List
(ii) Dictionary
(iii) Tuple
(iv) Array
X=20
Update()
print('X = ', X)
(f) Differentiate between ‘‘w’’ and ‘‘r’’ file modes used in Python.
Illustrate the difference using suitable examples. 2
(g) A pie chart is to be drawn (using pyplot) to represent Pollution Level
of Cities. Write appropriate statements in Python to provide labels
for the pie slices as the names of the Cities and the size of each pie
slice representing the corresponding Pollution of the Cities as per
the following table : 2
Cities Pollution
Mumbai 350
Delhi 475
Chennai 315
Bangalore 390
OR
.91/D 4
Write the output from the given Python code : 2
OR
OR
.91/D 5 P.T.O.
Write a Recursive function in Python Power(X,N), to return the
result of X raised to the power N where X and N are non-negative
integers. For example, if X is 5 and N is 3 then the function should
return the result of (5)3 i.e. 125. 3
(j) Write functions in Python for PushS(List) and for PopS(List) for
performing Push and Pop operations with a stack of List containing
integers. 4
OR
SECTION B
3. Fill in the blanks from questions 3(a) to 3(d).
(b) ___________ is a network tool used to test the download and upload
broadband speed. 1
(i) POP
(ii) VoIP
(iii) NFC
(iv) FTP
.91/D 6
(f) Match the ServiceNames listed in the first column of the following
table with their corresponding features listed in the second column
of the table : 2
Technology Feature
IP based Protocols (LTE)
1G
True Mobile Broadband
Improved Data Services with
2G Multimedia
Mobile Broadband
Basic Voice Services
3G
Analog-based Protocol
Better Voice Services
4G Basic Data Services
First Digital Standards (GSM, CDMA)
(h) Helping Hands is an NGO with its head office at Mumbai and
branches located at Delhi, Kolkata and Chennai. Their Head Office
located at Delhi needs a communication network to be established
between the head office and all the branch offices. The NGO has
received a grant from the national government for setting up the
network. The physical distances between the branch offices and the
head office and the number of computers to be installed in each of
these branch offices and the head office are given below. You, as a
network expert, have to suggest the best possible solutions for the
queries as raised by the NGO, as given in (i) to (iv).
.91/D 7 P.T.O.
Distances between various locations in Kilometres :
(ii) Suggest the most suitable location to install the main server
of this NGO to communicate data with all the offices. 1
.91/D 8
(iii) Write the name of the type of network out of the following,
which will be formed by connecting all the computer systems
across the network : 1
(A) WAN
(B) MAN
(C) LAN
(D) PAN
.91/D 9 P.T.O.
(i) What is the Degree of the table EMPLOYEES ? What is the
cardinality of the table DEPARTMENT ?
(ii) What is a Primary Key ? Explain.
OR
(f) Write whether the following statements are True or False for the
GET and POST methods in Django : 2
(i) POST requests are never cached.
(ii) GET requests do not remain in the browser history.
(g) Write outputs for SQL queries (i) to (iii), which are based on the
following tables, CUSTOMERS and PURCHASES : 3
Table : CUSTOMERS Table : PURCHASES
CNO CNAME CITIES SNO QTY PUR_DATE CNO
C1 SANYAM DELHI S1 15 2018-12-25 C2O
C2 SHRUTI DELHI S2 10 2018-11-10 C1
C3 MEHER MUMBAI S3 12 2018-11-10 C4
C4 SAKSHI CHENNAI S4 7 2019-01-12 C7
C5 RITESH INDORE S5 11 2019-02-12 C2
C6 RAHUL DELHI S6 10 2018-10-12 C6
C7 AMEER CHENNAI S7 5 2019-05-09 C8
C8 MINAKSHI BANGALORE S8 20 2019-05-09 C3
C9 ANSHUL MUMBAI S9 8 2018-05-09 C9
S10 15 2018-11-12 C5
S11 6 2018-08-04 C7
.91/D 10
(h) Write SQL queries for (i) to (iv), which are based on the tables :
CUSTOMERS and PURCHASES given in the question 4(g) : 4
SECTION D
.91/D 11 P.T.O.
(d) Consider the following scenario and answer the questions which
follow : 2
‘‘A student is expected to write a research paper on a topic. The
student had a friend who took a similar class five years ago. The
student asks his older friend for a copy of his paper and then
takes the paper and submits the entire paper as his own research
work.’’
(i) Which of the following activities appropriately categorises
the act of the writer ?
(A) Plagiarism
(B) Spamming
(C) Virus
(D) Phishing
(ii) Which kind of offense out of the following is made by the
student ?
(A) Cyber Crime
(B) Civil Crime
(C) Violation of Intellectual Property Rights
(e) What are Digital Rights ? Write examples for two digital rights
applicable to usage of digital technology. 2
.91/D 12
Series /C SET~4
Code No. 91
Roll No.
Candidates must write the Code on the
title page of the answer-book.
NOTE :
(i) Please check that this question paper contains 13 printed pages.
(ii) Code number given on the right hand side of the question paper should be
written on the title page of the answer-book by the candidate.
(iii) Please write down the serial number of the question in the answer-book before
attempting it.
(iv) 15 minute time has been allotted to read this question paper. The question paper
will be distributed at 10.15 a.m. From 10.15 a.m. to 10.30 a.m., the students
will read the question paper only and will not write any answer on the
answer-book during this period.
91 Page 1 P.T.O.
General Instructions :
(i) This question paper contains two parts Part A and B. Each part is compulsory.
(ii) Both Part A and Part B have choices.
(iii) Part A has two sections :
a. Section I is short answer questions, to be answered in one word or one line.
b. Section II has two case study-based questions. Each case study has
5 case-based subparts. An examinee is to attempt any 4 out of the 5 subparts.
(iv) Part B is Descriptive Paper.
(v) Part B has three sections :
a. Section I is short answer questions of 2 marks each in which two questions have
internal options.
b. Section II is long answer questions of 3 marks each in which two questions have
internal options.
c. Section III is very long answer questions of 5 marks each in which one question has
an internal option.
(vi) All programming questions are to be answered using Python Language only.
PART A
Section I
Select the most appropriate option out of the options given for each question. Attempt any
15 questions from questions no. 1 to 21.
3. Identify the statement(s) from the following options which will raise TypeError
exception(s) : 1
(A) print('5' * 3)
(B) print( 5 * 3)
(C) print('5' + 3)
(D) print('5' + '3')
91 Page 2
4. Identify the valid relational operator(s) in Python from the following : 1
(A) =
(B) <
(C) <>
(D) not
6. Write a single line statement in Python to assign the values 'BLUE', 'GREEN', 'RED'
to a tuple named Colours. 1
8. Write the name of the built-in function/method of the math module which when
executed upon 5.8 as parameter, would return the nearest smaller integer 5. 1
9. In context of Communication Networks, which of the following is the correct expansion for
the abbreviation PAN : 1
(A) Prime Area Network
(B) Post Application Network
(C) Picture Application Network
(D) Personal Area Network
10. In context of Cyber Crimes and Cyber Thefts, the term IPR refers to : 1
(A) Internet Protocol Rights
(B) Inter Personnel Rights
(C) Intellectual Property Rights
(D) Individual Property Rights
11. In SQL, write the name of the aggregate function which will display the cardinality of a
table. 1
12. Which of the following clauses in SQL is most appropriate to use to select matching tuples
in a specific range of values ? 1
(A) IN
(B) LIKE
(C) BETWEEN
(D) IS
91 Page 3 P.T.O.
13. Which of the following is not a valid datatype in SQL ? 1
(A) DATE
(B) STRING
(C) DECIMAL
(D) CHAR
15. Which of the following wireless transmission media is best suited for MAN ? 1
(A) Microwave
(B) Radio Link
(C) Infrared
(D) Bluetooth
17. What shall be the ouput for the execution of the following Python Code ? 1
Cities = ['Delhi', 'Mumbai']
Cities[0], Cities[1] = Cities[1], Cities[0]
print(Cities)
18. Which of the following commands in SQL is used to add a new record into a table ? 1
(A) ADD
(B) INSERT
(C) UPDATE
(D) NEW
19. Which of the following is the correct expansion of DML in context of SQL ? 1
(A) Direct Machine Language
(B) Data Mixing Language
(C) Distributed Machine Language
(D) Data Manipulation Language
91 Page 4
20. Which of the following statements correctly explains the term Firewall in context of
Computer Network Society ? 1
(A) A device that protects the computer network from catching fire.
(B) A device/software that controls incoming and outgoing network traffic.
(C) Using abusive language on a social network site.
(D) Stea it as his/her own work.
21. Which of the following protocols allows the use of HTML on the World Wide Web ? 1
(A) HTTP
(B) PPP
(C) FTP
(D) POP
Section II
Both the case study-based questions are compulsory. Attempt any 4 sub-parts from each question.
Each question carries 1 mark.
22. Anmol maintains that database of Medicines for his pharmacy using SQL to store the
data. The structure of the table PHARMA for the purpose is as follows :
Name of the table - PHARMA
The attributes of PHARMA are as follows :
MID - numeric
MNAME - character of size 20
PRICE - numeric
UNITS - numeric
EXPIRY - date
Table : PHARMA
91 Page 5 P.T.O.
(c) Anmol has received a new medicine to be added into his stock, but for which
he does not know the number of UNITS. So he decides to add the medicine
without its value for UNITS. The rest of the values are as follows :
91 Page 6
(a) Name the module she will import in Line 1. 1
(b) In which mode will she open the file to add data into the file in Line 2 ? 1
(c) In which mode will she open the file to read the data from the file in Line 3 ? 1
(d) File in the blank in Line 4 to read the data from a CSV file. 1
(e) Fill in the blank in Line 5 to close the file. 1
PART B
Section I
24. Evaluate the following Python expressions : 2
(a) 2 * 3 + 4 ** 2 5 // 2
OR
(b) Differentiate between the terms Domain Name and URL in context of web
services. Also write one example of each to illustrate the difference. 2
26. Expand the following terms in context of Computer Networks : 2
(a) PPP
(b) VoIP
(c) GSM
(d) WLL
27. (a) Explain the use of positional parameters in a Python function with the help of a
suitable example. 2
OR
(b) Explain the use of a default parameter in a Python function with the help of a
suitable example. 2
28. Rewrite the following code in Python after removing all syntax error(s) : 2
Underline each correction done in the code.
Runs = ( 10, 5, 0, 2, 4, 3 )
for I in Runs:
if I=0:
print(Maiden Over)
else
print(Not Maiden)
91 Page 7 P.T.O.
29. What possible output(s) is/are expected to be displayed on the screen at the time of
execution of the program from the following code ? Also specify the maximum and
minimum value that can be assigned to the variable R when K is assigned value as 2. 2
import random
Signal = [ 'Stop', 'Wait', 'Go' ]
for K in range(2, 0, 1):
R = randrange(K)
print (Signal[R], end = ' # ')
(c) Go # Wait #
(d) Go # Stop #
30. What are Tuples in a SQL Table ? Write a suitable example with a SQL Table to
illustrate your answer. 2
31. For the following SQL Table named PASSENGERS in a database TRAVEL:
A cursor named Cur is created in Python for a connection of a host which contains the
database TRAVEL. Write the output for the execution of the following Python statements
for the above SQL Table PASSENGERS: 2
Cur.execute('USE TRAVEL')
Cur.execute('SELECT * FROM PASSENGERS')
Recs=Cur.fetchall()
for R in Recs:
print(R[1])
32. Write the names of any two constraints and their respective uses in SQL. 2
91 Page 8
33. Write the output for the execution of the following Python code : 2
def change(A):
S=0
for i in range(len(A)//2):
S+=(A[i]*2)
return S
B = [10,11,12,30,32,34,35,38,40,2]
C = Change(B)
Print('Output is',C)
Section II
34. Write the definition of a function Sum3(L) in Python, which accepts a list L of integers
and displays the sum of all such integers from the list L which end with the digit 3. 3
then the function should display the sum of 123, 13, 23, i.e. 159 as follows :
Sum of integers ending with digit 3 = 159
35. (a) Write the definition of a function ChangeGender() in Python, which reads the
contents of a text file "BIOPIC.TXT" and displays the content of the file with
every occurrence of the word 'he' replaced by 'she'. For example, if the
content of the file "BIOPIC.TXT" is as follows : 3
Last time he went to Agra,
there was too much crowd, which he did not like.
So this time he decided to visit some hill station.
The function should read the file content and display the output as follows :
Last time she went to Agra,
there was too much crowd, which she did not like.
So this time she decided to visit some hill station.
OR
91 Page 9 P.T.O.
(b) Write the definition of a function Count_Line() in Python, which should read
each line of a text file "SHIVAJI.TXT" and count total number of lines present in
text file. For example, if the content of the file "SHIVAJI.TXT" is as follows : 3
36. Write the outputs of the SQL queries (i) to (iii) based on the relations CUSTOMER and
TRANSACTION given below : 3
Table : CUSTOMER
C1 RISHABH M 15000
C2 AAKASH M 12500
C3 INDIRA F 9750
C4 TUSHAR M 14600
C5 ANKITA F 22000
Table : TRANSACTION
91 Page 10
37. (a) Write the definition of a function POP_PUSH(LPop, LPush, N) in Python. The
function should Pop out the last N elements of the list LPop and Push them into
the list LPush. For example : 3
If the contents of the list LPop are [10, 15, 20, 30]
And value of N passed is 2,
then the function should create the list LPush as [30, 20]
And the list LPop should now contain [10, 15]
NOTE : If the value of N is more than the number of elements present in
LPop, then display the message "Pop not possible".
OR
(b) Write a function in Python POPSTACK(L) where L is a stack implemented by a
list of numbers. The function returns the value deleted from the stack. 3
Section III
38. A school library is connecting computers in its units in a LAN. The library has 3 units as
shown in the diagram below : 5
91 Page 11 P.T.O.
(a) Suggest the most suitable place (i.e. the Unit name) to install the server of
this Library with a suitable reason.
(b) Suggest an ideal layout for connecting these Units for a wired connectivity.
(c) Which device will you suggest to be installed and where should it be placed to
provide Internet connectivity to all the Units ?
(d) Suggest the type of the most efficient and economical wired medium for
connecting all the computers in the network.
(e) The university is planni
computer which is in his office at a distance of 50 metres. Which type of
network out of LAN, MAN or WAN will be used for the network ? Justify your
answer.
39. Write SQL statements for the following queries (i) to (v) based on the relations
CUSTOMER and TRANSACTION given below : 5
Table : CUSTOMER
C1 RISHABH M 15000
C2 AAKASH M 12500
C3 INDIRA F 9750
C4 TUSHAR M 14600
C5 ANKITA F 22000
Table : TRANSACTION
(a) To display all information about the CUSTOMERs whose NAME starts with
'A'.
(b) To display the NAME and BALANCE of Female CUSTOMERs (with GENDER as
'F') whose TRANSACTION Date (TDATE) is in the year 2019.
(c) To display the total number of CUSTOMERs for each GENDER.
(d) To display the CUSTOMER NAME and BALANCE in ascending order of GENDER.
(e) To display CUSTOMER NAME and their respective INTEREST for all
CUSTOMERs where INTEREST is calculated as 8% of BALANCE.
91 Page 12
40. (a) A binary file "PLANTS.dat" has structure (ID, NAME, PRICE).
Write the definition of a function countrec()in Python that would read contents
of the file "PATIENTS.dat" and display the details of those patients who have
the DISEASE as 'COVID-19'. The function should also display the total number
of such patients whose DISEASE is 'COVID-19'. 5
91 Page 13 P.T.O.
SET-4
Series %BAB%/C
Q.P. Code
91
COMPUTER SCIENCE
91 Page 1 P.T.O.
SECTION A
(Each question carries 2 marks)
(b) Out of the following, which has the largest network coverage area ? 1
Assume that the required library for establishing the connection between
Python and MySQL is already imported in the given Python code.
Also assume that DB is the name of the database connection for the given
table EMPLOYEE stored in the database COMPANY.
91 Page 2
5. Write the output of the SQL queries (a) to (d) based on the table TRAVEL
given below : 2
Table : TRAVEL
T_ID START END T_DATE FARE
101 DELHI CHENNAI 2021-12-25 4500
102 DELHI BENGALURU 2021-11-20 4000
103 MUMBAI CHENNAI 2020-12-10 5500
104 DELHI MUMBAI 2019-12-20 4500
105 MUMBAI BENGALURU 2022-01-15 5000
6. Write the output of the SQL queries (a) and (b) based on the following two
tables FLIGHT and PASSENGER belonging to the same database : 2
Table : FLIGHT
FNO DEPART ARRIVE FARE
F101 DELHI CHENNAI 4500
F102 DELHI BENGALURU 4000
F103 MUMBAI CHENNAI 5500
F104 DELHI MUMBAI 4500
F105 MUMBAI BENGALURU 5000
91 Page 3 P.T.O.
Table : PASSENGER
PNO NAME FLIGHTDATE FNO
P1 PRAKASH 2021-12-25 F101
P2 NOOR 2021-11-20 F103
P3 HARMEET 2020-12-10 NULL
P4 ANNIE 2019-12-20 F105
OR
(i) Identify and write the name of the Candidate Keys in the
given table BATSMEN.
(ii) How many tuples are there in the given table BATSMEN ? 2
91 Page 4
SECTION B
(Each question carries 3 marks)
91 Page 5 P.T.O.
9. (a) A SQL table BOOKS contains the following column names :
BOOKNO, BOOKNAME, QUANTITY, PRICE, AUTHOR
Write the SQL statement to add a new column REVIEW to store the
reviews of the book. 1
(b) Write the names of any two commands of DDL and any two
commands of DML in SQL. 2
10. Rashmi has forgotten the names of the databases, tables and the structure
of the tables that she had created in Relational Database Management
System (RDBMS) on her computer.
(a) Write the SQL statement to display the names of all the databases
present in RDBMS application on her computer.
(b) Write the statement which she should execute to open the database
named "STOCK".
(c) Write the statement which she should execute to display the
structure of the table "ITEMS" existing in the above opened
database "STOCK". 3
SECTION C
(Each question carries 4 marks)
11. Write SQL queries for (a) to (d) based on the tables CUSTOMER and
TRANSACT given below : 4
Table : CUSTOMER
CNO NAME GENDER ADDRESS PHONE
1001 Suresh MALE A-123, West Street 9310010010
1002 Anita FEMALE C-24, Court Lane 9121211212
1003 Harjas MALE T-1, Woods Avenue 9820021001
Table : TRANSACT
TNO CNO AMOUNT TTYPE TDATE
T1 1002 2000 DEBIT 2021-09-25
T2 1003 1500 CREDIT 2022-01-28
T3 1002 3500 CREDIT 2021-12-31
T4 1001 1000 DEBIT 2022-01-10
91 Page 6
(a) Write the SQL statements to delete the records from table
TRANSACT whose amount is less than 1000.
(b) Write a query to display the total AMOUNT of all DEBITs and all
CREDITs.
(c) Write a query to display the NAME and corresponding AMOUNT of all
CUSTOMERs who made a transaction type (TTYPE) of CREDIT.
(d) Write the SQL statement to change the Phone number of customer
whose CNO is 1002 to 9988117700 in the table CUSTOMER.
OR
(b) Write the names of two wired and two wireless data transmission
mediums. 2
13. The government has planned to develop digital awareness in the rural
areas of the nation. According to the plan, an initiative is taken to set up
Digital Training Centers in villages across the country with its Head
Office in the nearest cities. The committee has hired a networking
consultancy to create a model of the network in which each City Head
Office is connected to the Training Centers situated in 3 nearby villages.
Village 3
Training
Village 2 Center
Training
Center
91 Page 8
(a) It is observed that there is a huge data loss during the process of
data transfer from one village to another. Suggest the most
appropriate networking device out of the following, which needs to
be placed along the path of the wire connecting one village with
another to refresh the signal and forward it ahead.
(i) MODEM
(ii) ETHERNET CARD
(iii) REPEATER
(iv) HUB
(c) Which hardware networking device, out of the following, will you
suggest to connect all the computers within the premises of every
Village Training Center ?
(i) SWITCH
(ii) MODEM
(iii) REPEATER
(iv) ROUTER
(d) Which protocol, out of the following, will be most helpful to conduct
online interactions of Experts from the City Head Office and people
at the three Village Training Centers ?
(i) FTP
(ii) PPP
(iii) SMTP
(iv) VoIP
91 Page 9 P.T.O.
Series HEFG/C Set-4
Q.P. Code 91
Roll No.
$*
General Instructions :
This question paper contains five sections, Section A to E.
All questions are compulsory.
Section A has 18 questions carrying 1 mark each.
Section B has 7 Very Short Answer (VSA) type questions carrying 2 marks each.
Section C has 5 Short Answer (SA) type questions carrying 3 marks each.
Section D has 3 Long Answer (LA) type question carrying 5 marks each.
Section E has 2 questions carrying 4 marks each. One internal choice is given
in Q 35 against part C only.
All programming questions are to be answered using Python Language only.
91 ^ Page 1 of 19 P.T.O.
SECTION A
(a) Dictionary
(b) String
(c) List
(d) Tuple
(a) Day.pop()
(b) Day.pop(2)
(c) Day.pop(1)
(d) Day.pop("Tuesday")
(c) NONE
(d) NULL
91 Page 2 of 19
5. Select the correct output of the code :
S="Amrit Mahotsav @ 75"
A=S.split(" ",2)
print(A)
(a) ('Amrit', 'Mahotsav', '@', '75')
(b) ['Amrit', 'Mahotsav', '@ 75']
(c) ('Amrit', 'Mahotsav', '@ 75')
(d) ['Amrit', 'Mahotsav', '@', '75']
6. Which of the following modes in Python creates a new file, if file does not
exist and overwrites the content, if the file exists ?
(a) r+ (b) r
(c) w (d) a
91 Page 4 of 19
14. What will the following expression be evaluated to in Python ?
print(6/3 + 4**3//8 4)
(a) 6.5
(b) 4.0
(c) 6.0
(d) 4
15. Which of the following functions is a valid built-in function for both list
and dictionary datatype ?
(a) items()
(b) len()
(c) update()
(d) values()
16. fetchone() method fetches only one row in a ResultSet and returns a
__________.
(a) Tuple
(b) List
(c) Dictionary
(d) String
Q. 17 and 18 are Assertion (A) and Reasoning (R) based questions. Mark
the correct choice as
(a) Both (A) and (R) are true and (R) is the correct explanation for (A).
(b) Both (A) and (R) are true and (R) is not the correct explanation for
(A).
18. Assertion (A) : readlines() reads all the lines from a text file and
returns the lines along with newline as a list of strings.
Reasoning (R) : readline() can read the entire text file line by line
without using any looping statements.
SECTION B
20. (a) Write any two differences between Fiber-optic cable and Coaxial
cable. 2
OR
(b) Write one advantage and one disadvantage of wired over wireless
communication. 2
91 Page 6 of 19
21. (a) Given is a Python string declaration : 1
NAME = "Learning Python is Fun"
Write the output of : print(NAME[-5:-10:-1])
24. (a) Write the output of the Python code given below : 2
g=0
def fun1(x,y):
global g
g=x+y
return g
def fun2(m,n):
global g
g=m-n
return g
k=fun1(2,3)
fun2(k,7)
print(g)
OR
91 Page 7 of 19 P.T.O.
(b) Write the output of the Python code given below : 2
a=15
def update(x):
global a
a+=2
if x%2==0:
a*=x
else:
a//=x
a=a+5
print(a,end="$")
update(5)
print(a)
SECTION C
Table : Sport
ADMNO GAME
1100 CRICKET
1103 FOOTBALL
91 Page 8 of 19
(b) Write the output of the queries (i) to (iv) based on the table,
GARMENT given below : 2
TABLE : GARMENT
GCODE TYPE PRICE FCODE ODR_DATE
G101 EVENING GOWN 850 F03 2008-12-19
G102 SLACKS 750 F02 2020-10-20
G103 FROCK 1000 F01 2021-09-09
G104 TULIP SKIRT 1550 F01 2021-08-10
G105 BABY TOP 1500 F02 2020-03-31
G106 FORMAL PANT 1250 F01 2019-01-06
27. (a) Write a function in Python that displays the book names having
y in their name from a text file Bookname.t 3
Example :
s the names of following books :
OR
91 Page 9 of 19 P.T.O.
(b) Write a function RevString()
prints the words The rest of the
content is displayed normally. 3
Example :
If content in the text file is :
UBUNTU IS AN OPEN SOURCE OPERATING SYSTEM
Output will be :
UBUNTU IS AN NEPO SOURCE GNITAREPO SYSTEM
28. Write the output of any three SQL queries (i) to (iv) based on the tables
COMPANY and CUSTOMER given below : 3
Table : COMPANY
CID C_NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY CHENNAI MOBILE
666 DELL DELHI LAPTOP
Table : CUSTOMER
CUSTID CID NAME PRICE QTY
C01 222 ROHIT SHARMA 70000 20
C02 666 DEEPIKA KUMARI 50000 10
C03 111 MOHAN KUMAR 30000 5
C04 555 RADHA MOHAN 30000 11
91 Page 10 of 19
29. Write a function search_replace() in Python which accepts a list L of
numbers and a number to be searched. If the number exists, it is replaced
by 0 and if the number does not exist, an appropriate message is
displayed. 3
Example :
L = [10,20,30,10,40]
Number to be searched = 10
(ii) Pop_element() To pop the object from the stack and display it.
For example :
If the lists of courses details are :
3]
2]
3]
2]
3]
91 Page 11 of 19 P.T.O.
SECTION D
31. ABC Consultants are setting up a secure network for their office campus
at Noida for their day-to-day office and web-based activities. They are
planning to have connectivity between three buildings and the head office
situated in Bengaluru. As a network consultant, give solutions to the
questions (i) to (v), after going through the building locations and other
details which are given below :
BUILDING 3
Number of computers
Building Number of Computers
Building 1 25
Building 2 51
Building 3 150
Head Office 10
(i) Suggest the most suitable place to install the server for this
organization. Also, give reason to justify your suggested location. 1
(ii) Suggest the cable layout of connections between the buildings
inside the campus. 1
91 Page 12 of 19
(iii) Suggest the placement of the following devices with justification : 1
Switch
Repeater
(v) The System Administrator does remote login to any PC, if any
requirement arises. Name the protocol, which is used for the same. 1
import random
S=["Pen","Pencil","Eraser","Bag","Book"]
for i in range (1,2):
f=random.randint(i,3)
s=random.randint(i+1,4)
print(S[f],S[s],sep=":")
Options :
(I) Pencil:Book
(II) Pencil:Book
Eraser:Bag
(III) Pen:Book
Bag:Book
(IV) Bag:Eraser
91 Page 13 of 19 P.T.O.
(ii) The table Bookshop in MySQL contains the following
attributes :
B_code Integer
B_name String
Qty Integer
Price Integer
mydb=mysql.connect(host="localhost",
user="shop",passwd="Book",database="Bstore")
mycursor=__________ # Statement 1
qry= "update Bookshop set Qty=20 where
B_code=105"
___________________ # Statement 2
___________________ # Statement 3
OR
91 Page 14 of 19
(b) (i) Predict the output of the code given below : 2
text="LearningCS"
L=len(text)
ntext=""
for i in range (0,L):
if text[i].islower():
ntext=ntext+text[i].upper()
elif text [i].isalnum():
ntext=ntext+text[i 1]
else:
ntext=ntext+'&&'
print(ntext)
91 Page 15 of 19 P.T.O.
Statement 3 to read the complete result of the query into
the object named B_Details, from the table Bookshop in
the database.
mydb=mysql.connect(host="localhost",
user="shop",passwd="Book",database="Bstore")
mycursor=___________ # Statement 1
mycursor.execute("_________") # Statement 2
B_Details=__________ # Statement 3
for i in B_Details:
print(i)
33. (a) Write a point of difference between append (a) and write (w)
modes in a text file. 5
Write a program in Python that defines and calls the following
user defined functions :
(i) Add_Teacher() : It accepts the values from the user and
inserts
record consists of a list with field elements as T_id, Tname
and desig to store teacher ID, teacher name and
designation respectively.
(ii) Search_Teacher() : To display the records of all the PGT
(designation) teachers.
OR
(b) Write one point of difference between seek() and tell()
functions in file handling. Write a program in Python that defines
and calls the following user defined functions : 5
(i) Add_Device() : The function accepts and adds records of the
91 Page 16 of 19
SECTION E
Table : Salesperson
S_ID S_NAME AGE S_AMOUNT REGION
S001 SHYAM 35 20000 NORTH
S002 RISHABH 30 25000 EAST
S003 SUNIL 29 21000 NORTH
S004 RAHIL 39 22000 WEST
S005 AMIT 40 23000 EAST
91 Page 17 of 19 P.T.O.
35. Atharva is a programmer, who has recently been given a task to write a
Python code to perform the following binary file operation with the help
of a user defined function/module :
the item details stored in the binary file, items.dat, except for
the item whose item_id is 101. The data is stored in the following
format :
{item_id:[item_name,amount]}
def Copy_new():
f1=_____________ # Statement 2
f2=_____________ # Statement 3
item_detail=___________ # Statement 4
if _______________: # Statement 5
pickle.___________ # Statement 6
f1.close()
f2.close()
He has succeeded in writing partial code and has missed out certain
statements. Therefore, as a Python expert, help him to complete the code
91 Page 18 of 19
(i) Which module should be imported in the program ? (Statement 1) 1
(ii) Write the correct statement required to open the binary file
"items.dat". (Statement 2) 1
91 Page 19 of 19 P.T.O.