QP _ 03
QP _ 03
General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 5 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.
Ques
Question Marks
No
SECTION A
1 Which command comes under TCL (Transaction Control Language)?
1
(a) alter (b) update (c) grant (d) create
2 Which of the following is an invalid datatype in Python?
(a) list (b) Dictionary (c)Tuple (d) Class 1
3 Given the following dictionaries
dict_fruit = {"Kiwi":"Brown", "Cherry":"Red"}
dict_vegetable = {"Tomato":"Red", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries? 1
(a) dict_fruit.update(dict_vegetable) (b) dict_fruit + dict_vegetable
(c) dict_fruit.add(dict_vegetable) (d) dict_fruit.merge(dict_vegetable)
4 Consider the given expression:
not False and False or True
1
Which of the following will be correct output if the given expression is evaluated?
(a) True (b) False (c) NONE (d) NULL
5 Select the correct output of the code:
1
(a) update (b)remove (c) alter (d) drop
8 Which of the following commands will use to change the structure of table in MYSQL 1
database?
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) ALTER TABLE
9 What possible output(s) are expected to be displayed on screen at the time of execution
of the program from the following code?
import random
points=[20,40,10,30,15]
points=[30,50,20,40,45]
begin=random.randint(1,3) 1
last=random.randint(2,4) for c in
range(begin,last+1):
print(points[c],"#")
(a) 20#50#30# (b) 20#40#45
(c) 50#20#40# (d) both (b) and (c)
10 Fill in the blank:
is an attribute whose value is derived from the primary keyof some
other table. 1
(a) Primary Key (b) Foreign Key
(c) Candidate Key (d) Alternate Key
11 The tell() function returns:
(a) Number of bytes remaining to be read from the file
(b) Number of bytes already read from the file 1
(b) Number of the byte written to the file
(d) Total number of bytes in the file
12 Network in which every computer is capable of playing the role of a client, or a server or
both at same time is called :
(a) local area network
1
(b) peer-to-peer network
(c) dedicated server network
(d) wide area network
13 Which switching technique follows the store and forward mechanism?
(a) Circuit switching (b) message switching 1
(c) packet switching (d) All of these
14 What will the following expression be evaluated to in Python?
Print (16-(3+2)*5+2**3*4) 1
(a) 54 (b) 46 (c) 23 (d) 32
15 What will be the result of the following statements?
1
a) bool(int(“0‟)) b) type(“hello”)
16 Fill in the blank:
________ is a communication methodology designed to deliver both voice and
1
multimedia communications over Internet protocol.
(a) SMTP (b) VoIP (c) PPP (d) HTTP
Q 17 and 18 are ASSERTION AND REASONING 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
2
(c) A is True but R is False
(d) (d)A is false but R is True
17 Assertion (A):- key word arguments are related to the function calls.
Reasoning (R):- when you use keyword arguments in a function call, the caller identifies 1
the arguments by parameter name.
18 Assertion (A): CSV stands for Comma Separated Values
1
Reason (R): CSV files are a common file format for transferring and storingdata.
SECTION B
19 Jiya has written a Python program to add all the numbers of the list. Her code is having
errors. Rewrite the correct code and underline the corrections made.
define sum(numbers):
total = 0 2
for x in numbers
total += x
returns total
Print(sum([4, 6, 3, 5, 6]))
20 (a) Given is a Python string declaration:
mySubject = "Computer Science with Python"
Write the output of : print(mySubject[ -27 : -10 : 2])
28 Write a user-defined function Count_H_T() in Python that displays the number of lines
starting with ‘H’ and ‘T’ in the file “Poem.txt”.
3
4
Example, if the file contains:
Here we go round the mulberry bush,
The mulberry bush,
The mulberry bush.
Here we go round the mulberry bush
On a cold and frosty morning.
For example: 3
If the lists of Hostel details are:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
The output should be:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
Stack Empty
5
SECTION D
31 Write the SQL queries based on the relations Employee and Station Tables given below :
Table : Employee
E_ID Name Age Department DOJ Salary Gender
1 R K Mishra 32 Sales 2020-12-12 30000 M
2 A I Verma 35 Purchase 2018-07-01 40000 F
3 S Gupta 34 HR 2019-01-10 12000 M
4 G Dave 50 Purchase 2019-06-27 30000 M
5 S N Tripathi 33 Sales 2018-07-31 20000 F
6 S L Jain 44 HR 2019-02-25 21000 M
7 V K Parmar 31 Purchase 2017-03-24 20000 M
8 J Singh 42 Sales 2021-09-05 25000 M
4
Table : Station
P_ID Department Place
1 Sales Sector 21
2 Purchase Sector 35
3 HR Sector 17
(i) Display department wise maximum salary from the Employee Table.
(ii) Display Name, Salary, Department and Place for the Employees whose department
is Purchase.
(iii) Display Name and Place for female Employees.
(iv) Display details of male Employees who joined the Company before 01.07.2018.
32 Preeti Kothe is a Python programmer working in Datatech Pvt Ltd. For the Modern
Sports Ltd, he has created a csv file named sports.csv, to store the data of sports person.
Distance between the blocks and number of computers in each block areas given below:
5
6
Give answers :
(i) Suggest the most suitable block to host the server. Justify youranswer.
(ii) Draw the cable layout (Block to Block) to economically connectvarious blocks
within the Delhi campus of International Bank.
(iii) Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch
(iv) The bank is planning to connect its head office in London. Whichtype of network
out of LAN, MAN, or WAN will be formed? Justifyyour answer.
(v) Suggest a device/software to be installed in the Delhi Campus totake care of data
security.
OR 2+3=
(i) How are text files different from binary files? 5
(ii) A Binary file, STUDENT.DAT has the following structure:
[ rollno, sname, subject ]
Where rollno – Roll Number
sname – Student Name
subject is Student subject.
Write a user defined function, findStudent(sub), that accepts sub as parameter and
displays all the records from the binary file STUDENT.DAT, that have the value of
Student Subject as sub.