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

QP 083 Computer Science New

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

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.

You might also like