Set-3 QP
Set-3 QP
Q. SECTION A Marks
No.
1. State True or False: 1
‘‘A dictionary key must be of a data type that is mutable.”
2. A table has initially 5 columns and 8 rows. Consider the following sequence of operations 1
performed on the table
i. 8 rows are added
ii. 2 columns are added
iii. 3 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end of above operations?
(a) 13,8 (b) 8, 13 (c) 14,5 (d) 5,8
3. Predict the correct output of the following Python statement – 1
7%5==2 and 4%2>0 or 15//2==7.5
(a)True (b) False (c)None (d)Null
4. Predict the output of the following code. 1
data=[‘‘Python”,”Language”]
print(‘‘#”.join(data))
(a)Python#Language (b) Python Language# (c)#PYTHONLANGUAGE (d) None
SECTION B
19. (i) Write the full forms of the following. 1+1=2
a. SMTP b. PPP
(ii) How is http different from https.
OR
(i) Define modem and what is its purpose in networking.
(ii) Write any two differences between twisted pair cable and coaxial cable.
20. Find error in the following code(if any) and correct code by rewriting code and underline the 2
correction;‐
21. Write a user defined function that receives two string arguments and checks whether they 2
are same length strings (returns True in this case otherwise False).
OR
Write a user defined function zeroend(SCORE) to add all those values in the list SCORE,
which are ending with 0 and display the sum.
For example :
If the SCORE contains SCORE=[200,456,300,100,234,678]
The sum should be displayed as 60.
24. A table ITEM has been created in a database with the fields : ICODE,INAME,QTY,PRICE. 2
Write a query to add a new filed DISCOUNT (type integer) to the above table.
Then write query to delete column QTY from the table.
OR
Harish has written a query to increase the marks of students of ‘science’ stream by 5.But
he is not getting correct output. Help him by the correct query.
Table Student : [rno,name,class,stream,marks]
Query : Modify student change marks=marks+5 where stream equals ‘science’
Then write query to delete the commerce stream students whose name ends with ‘A’ from
table.
25. What is the output of the following python code. 2
L=[2,6,9,10]
def ListChange():
for i in range(len(L)):
if L[i]%2==0:
L[i]=L[i]*2
elif L[i]%3==0:
L[i]=L[i]*3
else:
L[i]=L[i]*5
ListChange()
for i in L:
print(i,end=‘‘#”)
SECTION C
26. Predict the output of the code given below. 3
def Convert(old):
l=len(old)
new=‘‘ ‘‘
for i in range(0,l):
if old[i].isupper():
new=new+old[i].lower()
elif old[i].islower():
new=new+old[i].upper()
elif old[i].isdigit():
new=new+”* ‘‘
else:
new=new+”% ‘‘
return new
older=‘‘InDia@2020”
newer=Convert(older)
print(‘‘Newer String is ‘‘,newer)
27. Consider the following table and write the outputs for the below queries. 1*3=3
TRAINER
TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998‐10‐15 90000
102 ANAMIKA DELHI 1994‐12‐24 80000
103 DEEPTI CHANDIGAR 2001‐12‐21 82000
104 MEENAKSHI DELHI 2002‐12‐25 78000
105 RICHA MUMBAI 1996‐01‐12 95000
106 MANIPRABHA CHENNAI 2001‐12‐12 69000
28. Write a use defined function SHOWWORD () in python to read from a text file STORY.TXT, 3
and display those words, whose length is less than 5.
OR
Write a user defined function LINESH(): in python that displays the number of lines starting
with 'H' in the file para.txt
29. Consider the table FLIGHT given below and write SQL queries for the following. 1*3=3
FLIGHT
FNO START END F_DATE FARE
F101 MUMBAI CHENNAI 2021-12-25 4500
F102 MUMBAI BENGALURU 2021-11-20 4000
F103 DELHI CHENNAI 2021-12-10 5500
F104 KOLKATA MUMBAI 2021-12-20 4500
F105 DELHI BENGALURU 2021-01-15 5000
i) Write a query to change the fare to 6000 of the flight whose FNO is F104.
ii) Write a query to delete the records of flights which end at MUMBAI.
iii)To display the average fare of all the flights.
30. Write a function in Python PUSH(Num), where Num is a list of numbers. From this list push 3
all numbers divisible by 5 into a stack implemented by using a list. Display the stack if it has
at least one element, otherwise display appropriate error message.
For example:
If the list Num is:
[66, 75, 40, 32, 10, 54]
A B C
D E
Distance between the blocks and number of computers in each block are as given below:
Distance Between Blocks No of Computers
Block B to Block C 30m Block A 55
Block C to Block D 30m Block B 180
Block D to Block E 35m Block C 60
Block E to Block C 40m Block D 55
Block D to Block A 120m Block E 70
Block D to Block B 45m
Block E to Block B 65m
(i) Suggest the most suitable block to host the server. Justify your answer.
(ii) Draw the cable layout (Block to Block) to economically connect various 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. Which type of network out of
LAN, MAN, or WAN will be formed? Justify your answer.
(v) Suggest a device/software to be installed in the Delhi Campus to take care of data
security
34. (i) Difference between ‘‘w” and ‘‘a” modes in text file handling. 2+3=5
(ii)A file sports.dat contains information about formal event participant. Write a user defined
function copydata() that would read contents from sports.dat and creates a file named
athletics.dat copying only those records from sports.dat where event name is ‘‘Atheltics”.
Record structure in sports.dat is as follows: [eventname,teamname,no_players]
OR
(i) How are text files different from binary files.
(ii) Write a user defined function to search and display the details of the employees (name,
designation and salary) whose salary is greater than 5000. The records are stored in the file
emp.dat. consider each record in the file emp.dat as a list containing name, designation and
salary.
35. (i) Define the term foreign key with respect to RDBMS. 1+4=5
(ii) Kiran wants to write a program in Python to insert the following record in the table
named EMP in My SQL Database HRMS.
Empno – integer
Empname – varchar(20)
Salary – integer
DOJ – date
Details to establish database connectivity between python and MySQL are :
{ username – root, password – cts , host – localhost }
Values of fields empno, empname and salary are to be accepted from user .
Help kiran in accomplishing the same using code in Python.
OR
(i) What is the purpose of ROLLBACK command in database transactions.
(ii) Satya has created a table named CRICKETERS in MYSQL database SPORTS with
following felds.
Rank – integer
Name – varchar(20)
DOB – date
Runs – int
Average – float
Details to establish database connectivity between python and MySQL are :
{ username – root, password –play, host – localhost }
Satya wants to display the records of those cricketers who scored more than 5000 runs.
Help Satya in accomplishing the same using code in Python.
-end-