Sample Paper 2 (CS)
Sample Paper 2 (CS)
Sample Paper 2 (CS)
Roll Number………………..
GURUKUL KURUKSHETRA
COMPUTER SCIENCE
SEPTEMBER EXAMINATION
SESSION (2019-20)
CLASS: XII (083)
(vii) Find and write the output of the following python code: 2
TXT = ["20","50","30","40"]
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float(T) + C
print(TOTAL)
CNT -= 1
(viii) Write logical expression for the following: 2
(1) Name is Rahul and age is between 20 to 25.
(2) CITY is either ‘Karnal’ or ‘Ambala’ but not ‘Chandigarh’.
(ix) Write the output of the following program on execution if x=80. 2
x=80
if x>60:
if x>25:
print("Good")
if x>90:
print("Better")
elif x>40:
print("Best")
else:
print("Invalid Output")
L.append(i)
for i in range(10,4,-2):
L1.append(i)
for i in range(len(L1)):
L2.append(L[i]+L1[i])
L2.append(len(L)-len(L1))
print(L2)
(xi) What output will be generated when the following Python code is
executed? 2
(xii) Write one similarity and one difference between List and Dictionary datatype. 2
(xiii) Define recursion with the help of example. 2
(xiv) Write a user-defined function in Python that displays the number of lines
starting with ‘H’ in the file hello.txt. Fr example, if the file contains: 2
Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
(xv) Write the python statement and the output for the following: 2
(a) To remove ‘h’ from word ‘hello’.
(b) To replace ‘o’ with ‘*’ in word ‘hello’.
4
(xvi) Write will be the output of the following python code, justify your answer.1
x=24
y=0
print(‘P’)
try:
print(‘Q’)
A=x/y
print(‘R’)
except ZeroDivisionError:
print(‘T’)
except:
print(‘S’)
finally:
print(‘Python program is over’)
As a network expert, provide the best possible answer for the following queries:
(i) Suggest the type of network established between the buildings.
(ii) Suggest the most suitable place (i.e., building) to house the server of this
organization.
(iii) Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or
from the network.
Table: CUSTOMER