PB-1 CS Jaipur Region
PB-1 CS Jaipur Region
PB-1 CS Jaipur Region
Page 1 of 7
following statements will
f my_dict is adictionary as defined below, then which of the 1
raise an exception?
my_dict ={'aman': 10, 'sumit': 20, 'suresh': 30}
(a) my_dict.get('suresh') (b) print(my_dict['aman', 'sumit])
(C) my dict['aman']=20 (d) print(str(my dict)
Þ Which of the following can delete an element from a list if the index of the element is
given?
(a) pop( ) (b)remove( )
(c) clear(O (d) allof these
9 Which of the following attributes can be considered as achoice for primary key?
(a) Name (b) Street
(c)Roll No (d) Subject
10 Write the missing statement to complete the folowing code: 1
file = open("abc.txt","r")
d= file.read(50)
#Move the file pointer to the beginning of the file
next_data = file.read(75)
file.close()
11 State whether the following statement is True or False: 1
An exception may be raisedeven if the program is syntactically correct.
12 \What will be the output of the following Python code ? 1
V= 50
def Change(n):
global v
V, n =n, v
print(v, n, sep = #, end ="@")
Change(20)
print(v)
(a)20#50@20 (b)50@20#50
(c)50#50#50 (d) 20@50#20
13 Which statement is used to modify data in a table?
(a) CHANGE (b) MODIFY (c) UPDATE (d) ALTER
14 How would you return all the rows froma table named"Item" sorted in descending 1
order on the column "IName"?
(a)SELECT * FROM Item SORT"IName' DESC:
(b) SELECT *FROM Item ORDER BY IName DESC :
(c) SELECT * FROM Item ORDERIName DESC:
(d) SELECT * FROM Item SORT BY 'IName' DESC;
15 LIKE clause is used for. 1
(a) For pattern matching (b) For table matching
(c) For inserting similar data in a table (d) For deleting data from atable
16 Count(") method count
(a) NULL values only (b)Empty Values
(c) ALL the values (d) None of these
17 The term HTTP stands for? 1
(a) Hyper terminal tracing program (b) Hypertext tracing protocol
(c) Hypertext transfer protocol (d) Hypertext transfer program
18 A device that connects networks with different protocols
(a)Switch (b) Hub (c) Gateway (d) Proxy Server
19 Which switching technique follows the store and forward mechanism? 1
Page 2 of 7
Z0 and Q21 are Assertion(A) and Reason(R) based questions. MarK the core
choice as:
(a) Both A and R are true and R is the correct
(b) explanation TorA
Both A and R.are true and.R.is-not the correct-explanation
(c) A is True but R is for A
(d) A is False but R is
False
True
20 ASSertion :-A parameter having a default value in the function header is known as a 1
default parameter.
Keason:- The default values for paramelers are considered only if no value is
provided for that parameter in the function call statement.
21 Assertion :- Both WHERE and HAVING clauses are used to specify conditions.
Reason:- The WHERE and HAVING clauses are interchangeable.
Page 4 of 7
OR
(B) Predict the output of the Python code given
T= "20", "50", "30", "40"] below:
Counter=3..
Total= 0
for Iin [7,5,4,6]:
newT=T[Counter]
Total= float (newT) + |
print(Total)
Counter=Counter-1
Mark
Section-D (4 x 4 = 16 Marks) 4
32 Write SQL queries for ()to(iv), which are based on the table: ACTIVITY given
below:
Table:ACTIVITY
PrizeMoney ScheduleDate
ACode ActivityName ParticipantsNum
10000 23-Jan-2004
1001 Relay100x4 16
12000 12-Dec-2003
1002 Highjump 10
8000 14-Feb-2004
1003 ShotPut 12
9000 01-Jan-2004
1005 LongJump 12
10 15000 19-Mar-2004
1008 DiscussThrow
descending order.
i) To display the name of all activities with their Acodes in
participants
(ii) To display sum of PrizeMoney for each of the Number of
groupings (as shown in column ParticipantsNum(10,12,16).
(iii) To display the Schedule Date and Participants Number for the activity
Relay100x4.
(iv) Toincrease PrizeMoney by500for High jump activity
OR
Write output for SQL queries(i) to(iii) and query for (iv), which are based on the
table: ACTIVITY:
(i) select count(distinct ParticipantsNum) from ACTIVITY;
(ii) select max(ScheduleDate),min(ScheduleDate) from ACTIVITY;
(ii) select sum(PrizeMoney) from ACTIVITY;
(iv) Write aquery to delete the record of Acode 1003.
33 Abhishek is making a software on "Countries &their Capitals" in which various 4
records are tobe stored/retrieved in CAPITAL.CSVdata file. It consists of some
records. As a programmer, you have to help him to successfully execute the
program.
Page 5 of 7
COMPANY
CID CNAME CITY
111
PRODUCTNAME
SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555
666
BLACKBERRY MADRAS MOBILE
DELL DELHI LAPTOP
CUSTOMER
CUSTID NAME
101
Rohan Sharma
PRICEQTY CID
102 70000 20 222
103
Deepak Kumar 50000 10 666
Mohan Kumar 30000 5
104 111
SahilBansal 35000
105 333
Neha Soni 25000 7
106 444
107
Sonal Aggarwal 20000 5 333
) To display those Arjun Singh 50000 15 666
than 30000. company name along with price which are having price less
(ii) To display the name and
to 35000.
price of the companies whose price is
between 20000
(iii) To increase the price by
1000 for those customer whose name
(iv) To display those product name, city starts with 'S'
as MOBILE. and price which are having product name
35 Kabir wants to write a
program in Python to insert the following record
named Student in MYSQL database, SCHOOL: in the table 4
rno(Roll number) - integer
name(Name) - string
DOB(Date of Birth) Date
- Fee-float
Note the followingto establish connectivity
Username- root between Pythonand MySQL:
Password - tiger
Host - localhost
The values of fieldsrno, name, DOB and fee
has to be accepted from the user.
Help Kabir to write the program in Python.
Q Section-E(2 x 5 = 10 Marks)
36 Amit is a manager working in a Mark
recruitment agency. He needs to manage the
records of various candidates. For 5
this, he wants the following information of each
candidate to be stored: -
Candidate |D-integer
Candidate Name - string
Designation - string
Experience -float
Page 6 of 7
You, as a programmer of the company, have been assigned to do this job for Amit.
i)Write a function to input the data of a candidate and append it in a binary file.
(ü) Write afunction to update the data of candidates whose experience is more
than 12.years.and.change.their.designation.to"Sr. Manager".
(ii)Write a function to read the data from the binary file and display the data of all
those candidates who are not "Sr. Manager".
37 PVS Computers decided to open anew office at Ernakulum, the office consist of 5
Building-4
Building-5
Building No of computers
Building 1and 2 20 Meters 40
Building 2 and 3 50 Meters 2 45
Page 7 of 7