CS Sample Paper Python
CS Sample Paper Python
SECTION-A
Q1. (a) Which of the following is valid logical operator in Python: [1]
(c) Name the Python Library modules which need to be imported to invoke the [1]
following functions: (i) exp( ) (ii) randint ()
(d) Rewrite the following code in python after removing all syntax error(s). [2]
Underline each correction done in the code.
Num = input("Number:")
Sum = 0
for i in range(10,Num,3)
Sum+=i
if i%2=0:
print ( i*2)
Else:
print ( i*3 print Sum)
1
(e) Find and write the output of the following python code: [1]
a=10
def call():
global a
a=15
b=20
print(a)
call()
print(a)
(f) Observer the following python code and write the output of the given code: [2]
def makenew(mystr):
newstr = ""
count = 0
for i in mystr:
if count%2 != 0:
newstr = newstr + str(count)
elif i.islower():
newstr = newstr + i.upper()
else:
newstr = newstr + i
count += 1
newstr = newstr + mystr[:1]
print("The new string is:", newstr)
makenew("sTUdeNT")
(g) Observe the following program and answer the question that follows: [2]
import random
x=3
N = random.randint (1, x)
for i in range (N):
print( i, "#", i + 1)
(1) What is the minimum and maximum number of times the loop will
execute? (2) Find out, which line of output(s) out of (i) to (iv) will not be
expected from the program?
i. 0#1 ii. 1#2 iii. 2#3 iv. 3#4
i) Write a function display(cities) that takes a list of cities as a parameter and print only
those cities which are beginning with alphabet ‘M’ only. [2]
Q3. a) Write a program to create a csv file “report.csv”. This file should store Adm No,
Name and Marks of Students, till user inputs ‘N’ in answer of Question “Add More
Records?”. [3]
Q6. a) Name two server side scripting language and two client side scripting
language. [1]
b) Which protocol in used in creating a connection with a remote machine? [1]
c) Identify the Domain name and URL from the following : [1]
http://www.income.in/home.aboutus.hml
d) Expand the following : [2]
GPRS , IMAP, CDMA, WiMax
e) What is the difference between packet & message switching? [1]
f) Hindustan Connecting World Association” is planning to start their offices in four
major cities in India to provide regional IT infrastructure support in the field of
Education & Culture. The company has planned to set up their head office in New Delhi
in three locations and have named their New Delhi offices as “Sales Office”, “Head
Office” and “Tech Office”. The company’s regional offices are located at “Coimbatore”,
“Kolkata” and “Ahmedabad”. A rough layout of the same is as follows: [4]
Modem
Telephone
Switch/ Hub
Ethernet Cable
Optical Fiber
Telephone Cable
(iv) Suggest a cable/ wiring layout for connecting the company’s local offices
located