QP - 02
QP - 02
global a
a.
global b=100
b.
global b
c.
global a=100
d.
13 Which file mode can be used to open a binary file in both append and 1
read mode?
a) w+ b) wb+ c) ab+ d) a+
14 In MYSQL database, if a table STD, has degree 4 and cardinality 5, 1
and another table, EMP has degree 3 and cardinality 6, what will be
the degree and cardinality of the Cartesian product of STD and EMP ?
a. 12, 11 b. 7, 30
c. 11, 12 d. 30, 7
15 Fill in the blank: 1
application provides access to command line interface
on a remote computer.
(a) FTP (b) PPP (c) Telnet (d) SMTP
[2]
16 Select the correct output of the code: 1
for i in "QUITE":
(a) q#u#i#t#e#
(b) [‘quite#’]
(c) ['q']#['u']#['i']#['t']#['e']#
(d) [‘quite’] #
19 Differentiate between Web server and web browser. Write any two 2
popular web browsers.
OR
(i) Define the term bandwidth with respect to networks.
(ii) How is http different from https?
20 Rewrite the following code in python after removing all the syntax 2
errors
Underline each correction done in the code.
21 Study the following program and select the possible output(s) from the 2
options (i) to (iv) following it. Also, write the maximum and the
minimum values that can be assigned to the
variable Y.
import random
X=random.random()
Y=
random.randint(0,4)
[3]
print(int(X),":",Y+int(X))
(i) 0 : 0
(ii) 1 : 6
(iii) 2 : 4
(iv) 0 : 3
OR
Write a function, lenWords(STRING), that takes a string as an argument
and returns a tuple containing length of each word of a string.
For example, if the string is "Hello how r you", the
tuple will have (4, 3, 1, 2)
22 Predict the output of the Python code given below : 2
myvalue = ["A", 40, "B", 60, "C", 20]
alpha = 0
beta = ""
gama = 0
for i in range(1,6,2):
alpha += i
beta += myvalue[i-1]+ "#"
gama += myvalue[i]
print(alpha, beta, gama)
23 Write the Python statement for each of the following tasks using BUILT- 2
IN functions/methods only:
(i) To delete an element 150 which has 4th index in the list L1.
(ii) To count number of words present in string :
Ex : s = “how are you friends”
Ans : 4
OR
(i) Given is a Python string declaration:
s=”Up Above The World So High”
Write the output of:
print(s[::-4])
(ii)Write the output of the code given below:
D={‘month’:’DECEMBER’,’exam’:’PREBOARD1’}
D[‘month’]=’JANUARY’
D[‘EXAM’]=’PRE2’
print(D.items())
24 Mr. Bhaumit has just created a table named “Emp” containing columns 2
Ename, Department and Salary. After creating the table, he realized
that he has forgotten to add a primary key column in the table. Help
him in writing an SQL command to add a primary key column EmpId of
integer type to the table Employee.
Thereafter, write the command to insert the following record in the
table:
[4]
EmpId- 101
Ename- Shweta
Department: Computer
Salary: 45500
OR
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('[email protected]')
[5]
SECTION - C
27 Write output of the queries (i) to (iii) based on the table Sportsclub 3
Table Name: Sportsclub
Table: Booking
ticketno passenger source destination quantity price Flightid
10001 ARUN BAN DEL 2 7000 10
10002 ORAM BAN KOL 3 7500 12
10003 SUMITA DEL MUM 1 6000 15
10004 ALI MUM KOL 2 5600 12
10005 GAGAN MUM DEL 4 5000 10
a) Write a query to display the passenger, source, model and price for all
bookings whose destination is KOL.
b) Identify the column acting as foreign key and the table name where it
is present in the above table.
c) Increase the price by 10% whose quantity is greater than 2.
30 Write a function in Python, Push(SItem) where , SItem is a dictionary containing the 3
details of stationary items– {Sname:price}.
The function should push the names of those items in the stack who have price
greater than 75. Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
[7]
Pen
The output should be:
The count of elements in the stack is 2
SECTION -D
31 Tarun creates a table RESULT with a set of records to maintain the marks 4
secured by students in Sem 1, Sem2, Sem3 and their division. After creation of
the table, he has entered data of 7 students in the table.
Table: RESULT
I) If two columns are added and 2 rows are deleted from the table result,
what will be the new degree and cardinality of the above table?
II) Insert the following record into the table – Roll No- 108, Name- Aadit,
Sem1- 470, Sem2-444, Sem3-475, Div – I.
III) Increase the SEM2 marks of the students by 3% whose name
begins with ‘N’.
IV) Add a column REMARKS in the table with datatype as varchar with 50
characters
32 Write a Program in Python that defines and calls the following user defined 4
functions:
KASHIPUR
APP CAMPUS
DEVELOP MOVIE
MENT EDITING
MUSSOORIE
CAMPUS
WEB
DESIGNING
(i) i) Suggest the most appropriate block/location to house the SERVER in 1 the Kas
effective connectivity. Justify your answer.
ii) Suggest a device/software to be installed in the Kashipur Campus
to take care of data security.
iii) Suggest the best wired medium and draw the cable layout (Block to 1
Block) to economically connect various blocks within the Kashipur
Campus.
OR
a) Difference between seek() and tell() with example
[9]
b) Kharanshu is a programmer, now he want to create a program as per
data given. AddStudents() to create a binary file called STUDENT.DAT
containing student information – roll number, name and marks (out of
100) of each student.
GetStudents() to display the name and percentage of those students who
have a percentage greater than 75. In case there is no student having
percentage > 75 the function displays an appropriate message. The
function should also display the average percent.
[10]