CS-XII
CS-XII
General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 4 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.
SECTION A
1. State True or False:
“In a Python program, if a break statement is given in a nested loop, it terminates the execution of all loops in one go.”
2. What will be the output of the following statement:
print(3-2**2**3+99/11)
a. 244 b. 244.0 c. -244.0 d. Error
3. Select the correct output of the code:
S= “Python is fun”
L=S.split()
S_new = “-“.join([10].upper(),1[1],1[2].capitalize()])
print(s_new)
a. PYTHON-IS-Fun b. PYTHON-is-Fun c. Python-is-fun d. PYTHON-Is -Fun
4. Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth Technology to connect
two devices. Which type of network will be formed in this case?
a. PAN b. LAN c. MAN d. WAN
5. Which of the following will delete key-value pair for key = “Red” from a dictionary D1?
a. delete D1("Red") b. del D1["Red"] c. del.D1["Red"] d. D1.del["Red"]
6. Consider the statements given below and then choose the correct output from the given options:
pride="#G20 Presidency"
print(pride[-2:2:-2])
a. ndsr b. ceieP0 c. ceieP d. yndsr
7. Which of the following statement(s) would give an error during execution of the following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
8. What possible outputs(s) will be obtained when the following code is executed?
import random
mynumber=random.randint(0,3)
color=[“yello”,”white”,”black”,”red”]
for i in range(1,mynumber):
print(color[i],end=”*”)
print()
a. RED* WHITE* BLACK*
b. WHITE* BLACK*
c. WHITE* WHITE* BLACK* BLACK*
d. YELLOW* WHITE*WHITE*
BLACK* BLACK* BLACK*
12. For communication, data in a network is divided into smaller chunks called ______________
a. Small data b. Parcel c. Packets d. Photons
13. Which of the following can be used as communication medium in LAN?
a. Ethernet Cable b. Optical fibre c. Wi-Fi d. All of the above
15. ________________ keyword is used while we need to create a user defined function.
a. def b. define c. declare d. None of these
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
a. Both A and R are true and R is the correct explanation for A
b. Both A and R are true and R is not the correct explanation for A
c. A is True but R is False
d. A is false but R is True
SECTION B
19. Expand the following terms:
a. POP3 , URL
b. Give one difference between XML and HTML.
OR
[2]
a. Define the term bandwidth with respect to networks.
b. How is http different from https?
20. The code given below accepts a number as an argument and returns the reverse number. Observe the following code
carefully and rewrite it after removing all syntax and logical errors. Underline all the corrections made.
21. What is the different between “r” and “w” modes of the text file?
OR
What is the difference between “r+” and “w+” modes of the text file?
23. Write the Python statement for each of the following tasks using BUILT-IN functions/methods only:
a. To insert an element 200 at the third position, in the list L1.
b. To check whether a string named, message ends with a full stop / period or not.
OR
A list named studentAge stores age of students of a class. Write the Python command to import the required module and
(using built-in function) to display the most common age value from the given list.
[3]
SECTION C
26 Predict the output of the Python code given below:
28. Write a function in Python to read a text file, Alpha.txt and displays the content of the file along with the line
numbers.
OR
Write a function, vowelCount() in Python that counts and displays the number of vowels in the text file named Poem.txt.
29. Differentiate between client server model and peer to peer model.
SECTION D
31. Be Happy Corporation has set up its new centre at Noida, Uttar Pradesh for its office and web-based activities. It has
4 blocks of buildings.
The distance between the various blocks is as follows:
A to B 40m
Block A 25
B to C 120m
Block B 50
C to D 100m
Block C 125
A to D 170m
Block D 10
B to D 150m
A to C 70m
[4]
32. Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an
incomplete python code (shown below) to create a CSV File ‘Student.csv’ (content shown below). Help him in
completing the code which creates the desired CSV File.
CSV File
1,AKSHAY,XII,A
2,ABHISHEK,XII,A
3,ARVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A
Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline=”) #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = [‘ROLL_NO’, ‘NAME’, ‘CLASS’, ‘SECTION’]
data.append(header)
for i in range(5):
roll_no = int(input(“Enter Roll Number : “))
name = input(“Enter Name : “)
Class = input(“Enter Class : “)
section = input(“Enter Section : “)
rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data) #Statement-5
fh.close()
a. Identify the suitable code for blank space in line marked as Statement-1
(i) csv file (iii). CSV
(ii) Csv (iv). csv
b. Identify the missing code for blank space in line marked as Statement-2?
(i) “School.csv”,”w” (iii). “Student.csv”,”w”
(ii) “Student.csv”,”r” (iv). “School.csv”,”r”
c. Choose the function name (with argument) that should be used in the blank space of line marked as Statement-3
(i) reader(fh) (iii). reader(MyFile)
(ii) writer(fh) (iv). writer(MyFile)
d. Identify the suitable code for blank space in line marked as Statement-4.
(i) ‘ROLL_NO’, ‘NAME’,’CLASS’,’SECTION’
(ii) ROLL_NO, NAME, CLASS, SECTION
(iii) ‘roll_no’, ‘name’,’Class’,’section’
(iv) Roll_no, name, Class, section
e. Choose the function name that should be used in the blank space of line marked as Statement-5 to create the
desired CSV File?
(i) dump( ) (iii). load( )
(ii) writerows( ) (iv). writerow( )
SECTION E
33. Surya is a manager working in a recruitment agency. He needs to manage the records of various
candidates. For this, he wants the following information of each candidate to be stored:
- Candidate_ID – integer
- Candidate_Name – string
- Designation – string
- Experience – float
[5]
You, as a programmer of the company, have been assigned to do this job for Surya.
a. Write a function to input the data of a candidate and append it in a binary file.
b. Write a function to update the data of candidates whose experience is more than 10 years and change their
designation to "Senior Manager".
c. Write a function to read the data from the binary file and display the data of all those candidates who are not
"Senior Manager".
34. Write a python script which has different functions to perform the following tasks:-
a. createBinaryFile function to Create a binary file by taking the name of the file from user.
b. readBinaryFile function to read the content of the created binary file by taking the name of the file
from the user.
35. Answer the following questions:-
a. What is the difference between packet and circuit switching?
b. Write one advantage of Bus topology.
c. Which protocol is used to create a connection with remote machine?
d. Give any one advantage of optical fibres for being the best?
e. Which type of network (out of LAN, PAN and MAN) is formed, when you connect two mobiles using Bluetooth to
transfer a video?
[6]