QP PB XII CS
QP PB XII CS
Section-A
1. (a) Name the Python Library modules which need to be imported to invoke the
following functions:
1
(i) pow( ) (ii) uniform ( )
(d Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
r = input('enter any radius :')
2
a = pi * math.pow(r,2)
print("Area = " + a)
(e) Find and write the output of the following python code: 2
def ChangeList( ):
L=[ ]
L1=[ ]
L2=[ ]
for i in range(1, 10):
L.append(i)
Page 1 of 8
for i in range(10,1,-2):
L1.append(i)
for i in range(len(L1)):
L2.append(L1[i]+L[i])
L2.append(len(L)-len(L1))
print(L2)
ChangeList( )
(f) Find and write the output of the following python code:
def modify(P ,Q=10):
P=P/Q
Q=P%Q
print( P,"#",Q)
return (P)
A=300
3
B=30
A=modify(A,B)
print(A,"$",B)
B=modify(B)
print(A,"$",B)
A=modify(A)
print(A,"$",B)
(g Study the following program and select the possible output(s) from the
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)
2
print(int(X),":",Y+int(X))
i. 0:0
ii. 1:6
iii. 2:4
iv. 0:3
v.
2. (a) What is a Python module? 1
Page 2 of 8
(b Which statement is correct for dictionary?
(i) A dictionary is a ordered set of key:value pair
(ii) each of the keys within a dictionary must be unique
1
(iii) each of the values in the dictionary must be unique
(iv) values in the dictionary are immutable
print(x)
(e) Find and write the output of the following python code:
def myfunc(a):
a=a+2 1
a=a*2
return a
print(myfunc(2))
(f) Carefully observe the following Python code and answer the questions that 2
follow:
global x
x=5
def fun2( ):
x=3
print(x)
x=x+1
print(x)
fun2( )
Page 3 of 8
On execution, the above code produces the following output:
6
3
Explain the output with respect to the scope of the variables.
(i) What is a recursive function? Write one advantage and one limitation of using
recursive function.
OR 3
Write a recursive function recsum(n) that computes the sum of number
1…..n ; get the value of last number n from the user.
Page 4 of 8
Age integer
def isEmpty(stk):
if stk == [ ]:
return True
else:
return False
def stkpush(stk, item):
# Write the code to push student details using stack.
def stkpop(stk):
# Write the code to pop a student using stack.
Section-B
3. _________ is Internet-based computing for sharing resources, softwares and
(a) 1
information on demand.
(d
CSMA/CA is used for _______________ in wireless network 1
(h PVS Computers decided to open a new office at Ernakulum, the office consist 4
of Five Buildings and each contains number of computers. The details are
shown below.
Page 5 of 8
Building-2
Building-1 Building-3
Building-5 Building-4
Computers in each building are networked but buildings are not networked so
far. The Company has now decided to connect building also.
(i) Suggest a cable layout for connecting the buildings
(ii) Do you think anywhere Repeaters required in the campus? Why
(iii) The company wants to link this office to their head office at Delhi
(a) Which type of transmission medium is appropriate for such a link?
(b) What type of network would this connection result into?
(iv) Where server is to be installed? Why?
Section-C
4. (a) fetchone( ) method for fetching each record from Mysql to python is invoked
1
using cursor object. Is it True?
(b What is the default URL of your Django project when you run it on built in
1
server of Django?
(c) Which of the following file is not located in inner Django project folder? 1
i. manage.py
ii. urls.py
Page 6 of 8
iii. _init.py
iv. settings.py
(d
Which command is used to create a new App EXAM in Django project? 1
(g Write a output for SQL queries (i) to (iii), which are based on the table: 3
SCHOOL and ADMIN given below:
TABLE: SCHOOL
TABLE: ADMIN
Page 7 of 8
1045 MALE HOD
(h Write SQL queries for (i) to (iv), which are based on the table: SCHOOL and
ADMIN given in the question 4(g):
i) To decrease period by 10% of the teachers of English subject.
iv) To display details of all teachers who have joined the school after
01/01/1999 in descending order of experience.
Section-D
5. (a) What is plagiarism? 1
(b
What is identity theft? 1
(c) List down some points about societal changes introduced by technology. 2
(d
What are the benefits of e-waste Recycling? 2
(e) Write any four steps that you can take to protect yourself from online
2
phishing.
(f) Enumerate any two disability issues while teaching and using computers 2
*************************************************************************
Page 8 of 8