SQP 2
SQP 2
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in
Q35 against part c only.
8. All programming questions are to be answered using Python Language only
SECTIONA
1. State True or False
"Python has a set of keywords that can also be used to declare variables"
4.
print(True or not True and False)
Choose one option from the following that will be the correct output after
executing the above python expression.
a) False b) True c) or d) not
11 Which of the following python statement will bring the read pointer to 10th
character from the end of a file containing 100 characters, opened for
reading in binary mode.
a) File.seek{10,0)
b) File.seek(-10,2)
c) File.seek(-10,1)
d) File.seek(10,2)
12 Which statement in MySql will display all the tables in a database?
a) SELECT* FROM TABLES;
b) USE TABLES;
c)DESCRIBE TABLES;
d) SHOW TABLES;
return rev
printfreverse(1234)
20 Mention two differences between a Hub and a switch in networking.
OR
d {}
for x in data:
if x in d:
dx=dx]+1
else:
dx]=1
print(d)
25 AMysQL table, sales have 10 rows. The following queries were executed on 2
the sales table.
SELECT COUNT(*) FROM sales;
COUNT()
10
OR
SECTION C
26 a) Consider the following tables Emp and Dept: 1+2
Relation: Emp
deptid Salary
Relation: Dept
empcode ename | deptid dname
1001 TOM 10 10000
11
10 Physics
1002 BOB 8000
1003 SID 10 9000 11 Chemistry
1004 JAY 12 9000 12 Biology
1005 JIM 11 10000
b) Write output of the queries (i) to (iv) based on the table Sportsclub
Table Name: Sportsclub
playerid pname sports country rating salary
10001 PELE SOCCER BRAZIL A | 50000
10002
FEDERER TENNIS SWEDEN A 20000
10003 VIRAT CRICKET INDIA A 15000
27 A pre-existing text file data.txt has some words written in it. Write a python
function displaywords() that will print all the words that are having length
greater than 3.
Example:
For the fie content:
A man always wants to strive higher in his life
He wants to be perfect.
OR
A pre-existing text file info.txt has some text written in it. Write a python
function countvowel() that reads the contents of the file and counts the
occurrence of vowels(A,E,J,0,U) in the file.
28 Based on the given set of tables write answers to the following questions.
Table: flights
flightidmodel Company
10 747 Boeing
12 320 Airbus
15 767 Boeing
Table:Booking
ticketno passenger | source destination quantity priceFlightid
10001 ARUN BAN DEL 7000 10
10002 ORAM BAN KOL 7500 12
10003 SUMITA DEL MUM 6000 15
For example:
If list Lcontains [3,5,10,12,15]
Then the modilist() should make the list L as |3,15,20,12,25]
30 |A dictionary contains the names of some cities and their population in crore. 3
Write a python function push(stack, data), that accepts an empty list, which
is the stack and data, which is the dictionary and pushes the names of those
countries onto the stack whose population is greater than 25 crores.
For example:
The data is having the contents {'India':140, 'USA':50, 'Russia':25, 'Japan':10}
then the execution of the function push() should push India and USA on the
stack.
OR
SECTION D
31 Magnolia Infotech wants to set up their computer network in the Bangalore 5
based campus having four buildings. Each block has a number of computers
that are required to be connected for ease of communication, resource
sharing and data security. You are required to suggest the best answers to
the questions i) to v) keeping in mind the building layout on the campus.
HR
Development
Admin
Logistics
Number of Computers.
Block Number of computers
Development 100
HR 120
Admin 200
Logistics 110
Distance Between the various blocks
Block Distance
Development to HR 50m
Development to Admin 75m
i) Suggest the most appropriate block to host the Server. Also justify
your choice.
ii) Suggest the device that should should be placed in the Server
building so that they can connect to Internet Service Provider to
avail Internet Services.
ii) Suggestthe wired medium and draw the cable block to block layout
to economically connect the various blocks.
iv) Suggest the placement of Switches and Repeaters in the network
with justification.
v Suggest the high-speed wired communication medium between
Bangalore Campus and Mysore campus to establish a data network.
print(m,n,x)
x=20
change(10)
change(20)
OR (only in a part)
name "9@Days"
for x in name:
if x in "aeiou":
str+=x.upper()
elif not x.isalnum():
str+="**"
elif x.isdigit():
pass
else:
str+=x.lower()
print(str)
b) Sumitra wants to write a program to connect to MySQL database using
python and increase the age of all the students who are studying in class 11
by 2 years.
Since she had little understanding of the coding, she left a few blank spaces
in her code. Now help herto complete the code by suggesting correct coding
for statements 1, 2 and 3.
33 A binary file data.dat needs to be created with following data written it in the 2+3
formof Dictionaries.
Rollno Name Age
1001 TOM 17
1002 BOB 16
1003 KAY 16
Write the following functions in python accommodate the data and
manipulate it.
a) A function insert() that creates the data.dat file in your system and
writes the three dictionaries.
b) A function() read() that reads the data from the binary file and displays
the dictionaries whose age is 16.
34 Tarun created the following table in MySQL to maintain stock for the items 1+1+
he has. 2
Table:Inventory
Productid stock
pname company price rating
10001 Biscuit Parley 1000 15 C
#Statement 1
headings = ['Country','Capital",'Population']