Nothing Special   »   [go: up one dir, main page]

CBSE Board QP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 81

Code No.

91/C
Candidates must write the Code on the
Roll No.
title page of the answer-book.

 Please check that this question paper contains 12 printed pages.


 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.
 Please check that this question paper contains 5 questions.
 Please write down the Serial Number of the question in the answer-book before
attempting it.
 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.

COMPUTER SCIENCE (NEW)


Time allowed : 3 hours Maximum Marks : 70

General Instructions :

(i) All questions are compulsory.

(ii) Question paper is divided into four sections  A, B, C and D.


• Section A : Unit-1 30
• Section B : Unit-2 15
• Section C : Unit-3 15
• Section D : Unit-4 10

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

(g) What possible output(s) are expected to be displayed on screen at


the time of execution of the program from the following code ? Also
specify the minimum and maximum values that can be assigned to
the variable End. 2
import random

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

(d) Write the output of the following Python code : 1


for i in range(2,7,2):
print(i * '$')

(e) Write the output of the following Python code : 1


def Update(X=10):
X += 15
print('X = ', X)

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

import matplotlib.pyplot as plt


Months = ['Dec','Jan','Feb','Mar']
Marks = [70, 90, 75, 95]
plt.bar(Months, Attendance)
plt.show()

(h) Write a function Show_words() in Python to read the content of a


text file 'NOTES.TXT' and display the entire content in capital
letters. Example, if the file contains : 2
"This is a test file"
Then the function should display the output as :
THIS IS A TEST FILE

OR

Write a function Show_words() in Python to read the content of a


text file 'NOTES.TXT' and display only such lines of the file which
have exactly 5 words in them. Example, if the file contains : 2
This is a sample file.
The file contains many sentences.
But needs only sentences which have only 5 words.
Then the function should display the output as :
This is a sample file.
The file contains many sentences :

(i) Write a Recursive function in Python RecsumNat(N), to return the


sum of the first N natural numbers. For example, if N is 10 then the
function should return (1 + 2 + 3 + ... + 10 = 55). 3

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

Write functions in Python for InsertQ(Names) and for


RemoveQ(Names) for performing insertion and removal operations
with a queue of List which contains names of students. 4

SECTION B
3. Fill in the blanks from questions 3(a) to 3(d).

(a) Computers connected by a network across different cities is an


example of ___________ . 1

(b) ___________ is a network tool used to test the download and upload
broadband speed. 1

(c) A ____________ is a networking device that connects computers in a


network by using packet switching to receive, and forward data to
the destination. 1

(d) ___________ is a network tool used to determine the path packets


taken from one IP address to another. 1

(e) Write the full form of the following abbreviations : 2

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

(g) What is a secure communication ? Differentiate between HTTP and


HTTPS. 3

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

Mumbai H.O. to Delhi 1420


Mumbai H.O. to Kolkata 1640
Mumbai H.O. to Chennai 2710
Delhi to Kolkata 1430
Delhi to Chennai 1870
Chennai to Kolkata 1750

Number of computers installed at various locations are as follows :

Mumbai H.O. 2500


Delhi branch 1200
Kolkata branch 1300
Chennai branch 1100

(i) Suggest by drawing the best cable layout for effective


network connectivity of all the Branches and the Head Office
for communicating data. 1

(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

(iv) Suggest the most suitable medium for connecting the


computers installed across the network out of the following : 1
(A) Optical fibre
(B) Telephone wires
(C) Radio waves
(D) Ethernet cable
SECTION C
4. (a) Which SQL command is used to add a new attribute in a table ? 1

(b) Which SQL aggregate function is used to count all records of a


table ? 1

(c) Which clause is used with a SELECT command in SQL to display


the records in ascending order of an attribute ? 1

(d) Write the full form of the following abbreviations : 1


(i) DDL
(ii) DML

(e) Observe the following tables, EMPLOYEES and DEPARTMENT


carefully and answer the questions that follow : 2
TABLE : EMPLOYEES TABLE : DEPARTMENT
ENO ENAME DOJ DNO DNO DNAME
E1 NUSRAT 2001-11-21 D3 D1 ACCOUNTS
E2 KABIR 2005-10-25 D1 D2 HR
D3 ADMIN

.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

Differentiate between Selection and Projection operations in context


of a Relational Database. Also, illustrate the difference with one
supporting example of each. 2

(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

(i) SELECT COUNT(DISTINCT CITIES) FROM CUSTOMERS;

(ii) SELECT MAX(PUR_DATE) FROM PURCHASES;


(iii) SELECT CNAME, QTY, PUR_DATE FROM CUSTOMERS,
PURCHASES WHERE CUSTOMERS.CNO = PURCHASES.CNO
AND QTY IN (10,20);

.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

(i) To display details of all CUSTOMERS whose CITIES are


neither Delhi nor Mumbai.
(ii) To display the CNAME and CITIES of all CUSTOMERS in
ascending order of their CNAME.
(iii) To display the number of CUSTOMERS along with their
respective CITIES in each of the CITIES.
(iv) To display details of all PURCHASES whose Quantity is
more than 15.

SECTION D

5. (a) An organisation purchases new computers every year and dumps


the old ones into the local dumping yard. Write the name of the most
appropriate category of waste that the organisation is creating every
year, out of the following options : 1
(i) Solid Waste
(ii) Commercial Waste
(iii) E-Waste
(iv) Business Waste

(b) Data which has no restriction of usage and is freely available to


everyone under Intellectual Property Rights is categorised as 1
(i) Open Source
(ii) Open Data
(iii) Open Content
(iv) Open Education

(c) What is a Unique Id ? Write the name of the Unique Identification


provided by Government of India for Indian Citizens. 2

.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

(f) Suggest techniques which can be adopted to impart Computer


Education for
(i) Visually impaired students (someone who cannot write).
(ii) Speech impaired students (someone who cannot speak). 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 check that this question paper contains 40 questions.

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

COMPUTER SCIENCE (NEW)

Time allowed : 3 hours Maximum Marks : 70

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.

1. Which of the following options is/are not Python Keywords ? 1


(A) False
(B) Math
(C) WHILE
(D) break

2. Given the dictionary D={'Rno': 1, 'Name':'Suraj'} , write the output of


print(D('Name')). 1

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

5. For a string S declared as S = 'PYTHON', which of the following is incorrect ? 1


(A) N=len(S)
(B) T = S
(C) 'T' in S
(D) S[0] = 'M'

6. Write a single line statement in Python to assign the values 'BLUE', 'GREEN', 'RED'
to a tuple named Colours. 1

7. A List is declared as L = ['ONE', 'TWO', 'THREE']


What will be the output of the statement ? 1
print(max(L))

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

14. Which of the following is not a valid DML command in SQL ? 1


(A) INSERT
(B) UPDATE
(C) ALTER
(D) DELETE

15. Which of the following wireless transmission media is best suited for MAN ? 1
(A) Microwave
(B) Radio Link
(C) Infrared
(D) Bluetooth

16. Which of the following is/are immutable object type(s) in Python ? 1


(A) List
(B) String
(C) Tuple
(D) Dictionary

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

MID MNAME PRICE UNITS EXPIRY

M1 PARACETAMOL 12 120 2022-12-25

M2 CETRIZINE 6 125 2022-10-12

M3 METFORMIN 14 150 2022-05-23

M4 VITAMIN B-6 12 120 2022-07-01

M5 VITAMIN D3 25 150 2022-06-30

M6 TELMISARTAN 22 115 2022-02-25

(a) Write the degree and cardinality of the table PHARMA. 1

(b) Identify the attribute best suitable to be declared as a primary key. 1

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 :

MID MNAME PRICE EXPIRY


M7 SUCRALFATE 17 2022-03-20
Write the SQL command which Anmol should execute to perform the required
task. 1
(d) Anmol wants to change the name of the attribute UNITS to QUANTITY in the
table PHARMA. Which of the following commands will he use for the
purpose ? 1
(i) UPDATE
(ii) DROP TABLE
(iii) CREATE TABLE
(iv) ALTER TABLE
(e) Now Anmol wants to increase the PRICE of all medicines by 5. Which of the
following commands will he use for the purpose ? 1
(i) UPDATE SET
(ii) INCREASE BY
(iii) ALTER TABLE
(iv) INSERT INTO
23. Roshni of Class 12 is writing a program in Python for her project work to create a CSV file
"Teachers.csv"
Number, Name for some entries. She has written the following code. However, she is
unable to figure out the correct statements in a few lines of the code, hence she has left
them blank. Help her to write the statements correctly for the missing parts in the code.
import _________ # Line 1
def addrec(Idno, Name): # to add record into the CSV file
f=open("Teachers.csv", _________) # Line 2
Filewriter = CSV.writer(f)
Filewriter.writerow([Idno,name])
f.close()
def readfile(): # to read the data from CSV file
f=open("Teachers.csv", ________) # Line 3
FileReader = CSV.________ (f) # Line 4
for row in FileReader:
print(row)
f._________ # Line 5

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

(b) 6 < 12 and not (20 > 15) or (10 > 5)


25. (a) What are cookies in a web browser ? Write one advantage and one disadvantage of
enabling cookies in a web browser. 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 = ' # ')

(a) Stop # Wait # Go #

(b) Wait # Stop #

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

TNO NAME START END

T1 RAVI KUMAR DELHI MUMBAI

T2 NISHANT JAIN DELHI KOLKATA

T3 DEEPAK PRAKASH MUMBAI PUNE

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

For example, if the list L is passed


[ 123, 10, 13, 15, 23]

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

Shivaji was born in the family of Bhonsle.

He was devoted to his mother Jijabai.

India at that time was under Muslim rule.


The function should read the file content and display the output as follows :
Total number of lines : 3

36. Write the outputs of the SQL queries (i) to (iii) based on the relations CUSTOMER and
TRANSACTION given below : 3

Table : CUSTOMER

ACNO NAME GENDER BALANCE

C1 RISHABH M 15000

C2 AAKASH M 12500

C3 INDIRA F 9750

C4 TUSHAR M 14600

C5 ANKITA F 22000

Table : TRANSACTION

ACNO TDATE AMOUNT TYPE

C1 2020-07-21 1000 DEBIT

C5 2019-12-31 1500 CREDIT

C3 2020-01-01 2000 CREDIT

(i) SELECT MAX(BALANCE), MIN(BALANCE)FROM CUSTOMER


WHERE GENDER = 'M';
(ii) SELECT SUM(AMOUNT), TYPE FROM TRANSACTION
GROUP BY TYPE;
(iii) SELECT NAME, TDATE, AMOUNT
FROM CUSTOMER C, TRANSACTION T
WHERE C.ACNO = T.ACNO AND TYPE = 'CREDIT';

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

The three units are providing the following services :


1. Teachers Unit : For access of the Library Books by teachers
2. Students Unit : For access of the Library Books by Students
3. Circulation Unit : For issue and return of books for teachers and students
Centre to Centre distances between the 3 units are as follows :
Circulation Unit to Teachers Unit 20 metres
Circulation Unit to Students Unit 30 metres
Teachers Unit to Students Unit 10 metres
Number of computers in each of the units is as follows :
Circulation Unit 15
Teachers Unit 10
Students Unit 10

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

ACNO NAME GENDER BALANCE

C1 RISHABH M 15000

C2 AAKASH M 12500

C3 INDIRA F 9750

C4 TUSHAR M 14600

C5 ANKITA F 22000

Table : TRANSACTION

ACNO TDATE AMOUNT TYPE

C1 2020-07-21 1000 DEBIT

C5 2019-12-31 1500 CREDIT

C3 2020-01-01 2000 CREDIT

(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 WRITEREC() in Python, to input


data for records from the user and write them to the file
PLANTS.dat.

Write the definition of a function SHOWHIGH() in Python, which


reads the records of PLANTS.dat and displays those records for
which the PRICE is more than 500. 5
OR

(b) A binary file "PATIENTS.dat" has structure (PID, NAME, DISEASE).

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

Roll No. Candidates must write the Q.P. Code on


the title page of the answer-book.

Please check that this question paper contains 9 printed pages.


Q.P. Code given on the right hand side of the question paper should be written
on the title page of the answer-book by the candidate.
Please check that this question paper contains 13 questions.
Please write down the serial number of the question in the
answer-book before attempting it.
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.

COMPUTER SCIENCE

Time allowed : 2 hours Maximum Marks : 35


General Instructions :
(i) This question paper is divided into 3 sections A, B and C.
(ii) Section A, consists 7 questions (1 7). Each question carries 2 marks.
(iii) Section B, consists 3 questions (8 10). Each question carries 3 marks.
(iv) Section C, consists 3 questions (11 13). Each question carries 4 marks.
(v) Internal choices have been given for questions number 7, 8 and 12.

91 Page 1 P.T.O.
SECTION A
(Each question carries 2 marks)

1. Differentiate between Push and Pop operations in the context of stacks. 2

2. (a) Expand FTP. 1

(b) Out of the following, which has the largest network coverage area ? 1

LAN, MAN, PAN, WAN

3. Differentiate between Degree and Cardinality in the context of Relational


Data Model. 2

4. Consider the following table EMPLOYEE in a Database COMPANY :


Table : EMPLOYEE
E_ID NAME DEPT
H1001 Avneet AC
A1002 Rakesh HR
A1003 Amina AC
H1002 Simon HR
A1004 Pratik AC

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.

Predict the output of the following Python code : 2


CUR=DB.cursor()
CUR.execute("USE COMPANY")
CUR.execute("SELECT * FROM EMPLOYEE WHERE DEPT = 'AC' ")
for i in range(2) :
R=CUR.fetchone()
print(R[0], R[1], sep ="#")

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

(a) SELECT START, END FROM TRAVEL


WHERE FARE <= 4000 ;

(b) SELECT T_ID, FARE FROM TRAVEL


WHERE T_DATE LIKE '2021-12-%' ;

(c) SELECT T_ID, T_DATE FROM TRAVEL WHERE END = 'CHENNAI'


ORDER BY FARE ;

(d) SELECT START, MIN(FARE)


FROM TRAVEL GROUP BY START ;

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

(a) SELECT NAME, DEPART FROM FLIGHT


NATURAL JOIN PASSENGER ;

(b) SELECT NAME, FARE


FROM PASSENGER P, FLIGHT F
WHERE F.FNO = P.FNO AND F.DEPART = 'MUMBAI' ;

7. (a) Explain Primary Key in the context of Relational Database Model.


Support your answer with suitable example. 2

OR

(b) Consider the following table BATSMEN :


Table : BATSMEN
PNO NAME SCORE
P1 RISHABH 52
P2 HUSSAIN 45
P3 ARNOLD 23
P4 ARNAV 18
P5 GURSHARAN 52

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

8. (a) Write separate user defined functions for the following : 3


(i) PUSH(N) This function accepts a list of names, N as parameter.
It then pushes only those names in the stack named OnlyA
which contain the letter 'A'.
(ii) POPA(OnlyA) This function pops each name from the stack
OnlyA and displays it. When the stack is empty, the message
"EMPTY" is displayed.
For example :
If the names in the list N are
['ANKITA', 'NITISH', 'ANWAR', 'DIMPLE', 'HARKIRAT']
Then the stack OnlyA should store
['ANKITA', 'ANWAR', 'HARKIRAT']
And the output should be displayed as
HARKIRAT ANWAR ANKITA EMPTY
OR
(b) Write the following user defined functions : 3
(i) pushEven(N) This function accepts a list of integers named N
as parameter. It then pushes only even numbers into the stack
named EVEN.
(ii) popEven(EVEN) This function pops each integer from the
stack EVEN and displays the popped value. When the stack is
empty, the message "Stack Empty" is displayed.
For example :
If the list N contains
[10,5,3,8,15,4]
Then the stack, EVEN should store
[10,8,4]
And the output should be
4 8 10 Stack Empty

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.

12. (a) (i) Mention any two characteristics of BUS Topology. 2

OR

(ii) Differentiate between the terms Domain Name and URL in


the context of World Wide Web. 2

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

As a network expert in the consultancy, you have to suggest the best


network-related solutions for the issues/problems raised in (a) to (d),
keeping in mind the distance between various locations and other given
parameters. 4
91 Page 7 P.T.O.
Layout of the City Head Office and Village Training Centers :

City Head Village 1


Training
Office Center

Village 3
Training
Village 2 Center
Training
Center

Shortest distances between various Centers :

Village 1 Training Center to City Head Office 2 KM

Village 2 Training Center to City Head Office 1·5 KM

Village 3 Training Center to City Head Office 3 KM

Village 1 Training Center to Village 2 Training Center 3·5 KM

Village 1 Training Center to Village 3 Training Center 4·5 KM

Village 2 Training Center to Village 3 Training Center 3·5 KM

Number of Computers installed at various centers are as follows :

Village 1 Training Center 10

Village 2 Training Center 15

Village 3 Training Center 15

City Head Office 100

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

(b) Draw the cable layout (location-to-location) to efficiently connect


various Village Training Centers and the City Head Office for the
above shown layout.

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

COMPUTER SCIENCE (NEW)


Time allowed : 3 hours Maximum Marks : 70

Please check that this question paper contains 19 printed pages.


Q.P. Code given on the right hand side of the question paper should be
written on the title page of the answer-book by the candidate.
Please check that this question paper contains 35 questions.
Please write down the serial number of the question in the
answer-book before attempting it.
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.

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

All questions carrying 1 mark each. 18 1=18

1. State True or False.

2. Which of the following is not a sequential datatype in Python ?

(a) Dictionary
(b) String

(c) List

(d) Tuple

3. Given the following dictionary


Day={1:"Monday", 2: "Tuesday", 3: "Wednesday"}
Which statement will return "Tuesday".

(a) Day.pop()
(b) Day.pop(2)

(c) Day.pop(1)
(d) Day.pop("Tuesday")

4. Consider the given expression :


7<4 or 6>3 and not 10==10 or 17>4
Which of the following will be the correct output if the given expression is
evaluated ?
(a) True
(b) False

(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

7. Fill in the blank :


___________ is not a valid built-in function for list manipulations.
(a) count()
(b) length()
(c) append()
(d) extend()

8. Which of the following is an example of identity operators of Python ?


(a) is (b) on
(c) in (d) not in

9. Which of the following statement(s) would give an error after executing


the following code ?
S="Happy" # Statement 1
print(S*2) # Statement 2
S+="Independence" # Statement 3
S.append("Day") # Statement 4
print(S) # Statement 5
(a) Statement 2 (b) Statement 3
(c) Statement 4 (d) Statement 3 and 4
91 Page 3 of 19 P.T.O.
10. Fill in the blank :
In a relational model, tables are called _________, that store data for
different columns.
(a) Attributes
(b) Degrees
(c) Relations
(d) Tuples

11. The correct syntax of tell() is :


(a) tell.file_object()
(b) file_object.tell()
(c) tell.file_object(1)
(d) file_object.tell(1)

12. Fill in the blank :


_________ statement of SQL is used to insert new records in a table.
(a) ALTER
(b) UPDATE
(c) INSERT
(d) CREATE

13. Fill in the blank :


In _________ switching, before a communication starts, a dedicated path
is identified between the sender and the receiver.
(a) Packet
(b) Graph
(c) Circuit
(d) Plot

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

(c) (A) is true but (R) is false.

(d) (A) is false but (R) is true.


91 Page 5 of 19 P.T.O.
17. Assertion (A) : In Python, a stack can be implemented using a list.
Reasoning (R) : A stack is an ordered linear list of elements that works
on the principle of First In First Out (FIFO).

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

19. Ravi, a Python programmer, is working on a project in which he wants to


write a function to count the number of even and odd values in the list.
He has written the following code but his code is having errors. Rewrite
the correct code and underline the corrections made. 2
define EOCOUNT(L):
even_no=odd_no=0
for i in range(0,len(L))
if L[i]%2=0:
even_no+=1
Else:
odd_no+=1
print(even_no, odd_no)

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

(b) Write the output of the code given below : 1


dict1={1:["Rohit",20], 2:["Siya",90]}
dict2={1:["Rahul",95], 5:["Rajan",80]}
dict1.update(dict2)
print(dict1.values())

22. Explain the usage of HAVING clause in GROUP BY command in RDBMS


with the help of an example. 2

23. (a) Write the full forms of the following : 1


(i) XML
(ii) HTTPS

(b) What is the use of FTP ? 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)

25. (a) Differentiate between IN and BETWEEN operators in SQL with


appropriate examples. 2
OR
(b) Which of the following is NOT a DML command. 2
DELETE, DROP, INSERT, UPDATE

SECTION C

26. (a) Consider the following tables Student and Sport :


Table : Student
ADMNO NAME CLASS
1100 MEENA X
1101 VANI XI

Table : Sport
ADMNO GAME
1100 CRICKET
1103 FOOTBALL

What will be the output of the following statement ? 1


SELECT * FROM Student, Sport;

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

(i) SELECT DISTINCT(COUNT(FCODE))FROM GARMENT;

(ii) SELECT FCODE, COUNT(*), MIN(PRICE) FROM


GARMENT GROUP BY FCODE HAVING COUNT(*)>1;

(iii) SELECT TYPE FROM GARMENT WHERE ODR_DATE


>'2021-02-01' AND PRICE <1500;

(iv) SELECT * FROM GARMENT WHERE TYPE LIKE 'F%';

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 :

One Hundred Years of Solitude


The Diary of a Young Girl
On the Road

After execution, the output will be :

One Hundred Years of Solitude


The Diary of a Young Girl

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

(i) SELECT PRODUCTNAME, COUNT(*)FROM COMPANY GROUP BY


PRODUCTNAME HAVING COUNT(*)> 2;
(ii) SELECT NAME, PRICE, PRODUCTNAME FROM COMPANY C,
CUSTOMER CT WHERE C.CID = CU.CID AND C_NAME = 'SONY';
(iii) SELECT DISTINCT CITY FROM COMPANY;
(iv) SELECT * FROM COMPANY WHERE C_NAME LIKE '%ON%';

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

List after replacement :


L = [0,20,30,0,40]

30. A list contains following record of course details for a University :


[Course_name, Fees, Duration]

Write the following user defined functions to perform given operations on


the stack named 'Univ' : 3
(i) Push_element() To push an object containing the
Course_name, Fees and Duration of a course, which has fees
greater than 100000 to the stack.

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

The stack should contain :

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 :

NOIDA BRANCH BENGALURU BRANCH

BUILDING 1 HEAD OFFICE


BUILDING 2

BUILDING 3

Distance between various blocks/locations :


Building Distance
Building 1 to Building 3 120 m
Building 1 to Building 2 50 m
Building 2 to Building 3 65 m
Noida Branch to Head Office 1500 km

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

(iv) The organization is planning to provide a high-speed link with the


head office situated in Bengaluru, using a wired connection.
Suggest a suitable wired medium for the same. 1

(v) The System Administrator does remote login to any PC, if any
requirement arises. Name the protocol, which is used for the same. 1

32. (a) (i) What possible output(s) are expected to be displayed on


screen at the time of execution of the following code ? 2

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

Note the following to establish connectivity between Python


and MySQL o :
Username is shop
Password is Book
The table exists in a MySQL database named
Bstore.
The code given below updates the records from the table
Bookshop in MySQL. 3
Statement 1 to form the cursor object.
Statement 2 to execute the query that updates the Qty to
20 of the records whose B_code is 105 in the table.
Statement 3 to make the changes permanent in the
database.

import mysql.connector as mysql


def update_book():

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)

(ii) The table Bookshop in MySQL contains the following


attributes :
B_code Integer
B_name String
Qty Integer
Price Integer

Note the following to establish connectivity between Python


and MySQL o :
Username is shop
Password is Book
The table exists in a MySQL database named
Bstore.
The code given below reads the records from the table
Bookshop and displays all the records : 3
Statement 1 to form the cursor object.
Statement 2 to write the query to display all the records
from the table.

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.

import mysql.connector as mysql


def Display_book():

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

consists of a list with field elements as P_id, P_name and


Price to store peripheral device ID, device name, and price
respectively.
(ii) Count_Device() : To count and display number of peripheral
devices, whose price is less than < 1000.

91 Page 16 of 19
SECTION E

34. The ABC Company is considering to maintain their salespersons records


using SQL to store data. As a database administrator, Alia created the
table Salesperson and also entered the data of 5 Salespersons.

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

Based on the data given above, answer the following questions :


(i) Identify the attribute that is best suited to be the Primary Key and
why ? 1
(ii) The Company has asked Alia to add another attribute in the table.
What will be the new degree and cardinality of the above table ? 1
(iii) Write the statements to : 2
(a) Insert details of one salesman with appropriate data.
(b) SHYAM SOUTH
table Salesperson.

OR (Option for part iii only)

(iii) Write the statement to : 2


(a) Delete the record of salesman RISHABH, as he has left the
company.
(b) Remove an attribute REGION from the table.

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 :

Copy_new() : to create a binary file new_items.dat and write all

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

import ___________ # Statement 1

def Copy_new():

f1=_____________ # Statement 2

f2=_____________ # Statement 3

item_id=int(input("Enter the item id"))

item_detail=___________ # Statement 4

for key in item_detail:

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

based on the given requirements :

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

(iii) Which statement should Atharva fill in Statement 3 to open the


binary file "new_items.dat" and in Statement 4 to read all the
details from the binary file "items.dat". 2

OR (Option for part iii only)

(iii) What should Atharva write in Statement 5 to apply the given


condition and in Statement 6 to write data in the binary file
"new_items.dat". 2

91 Page 19 of 19 P.T.O.

You might also like