Class XI Computer Science Syllabus 2025-26
Class XI Computer Science Syllabus 2025-26
1. Learning Outcomes
2. Distribution of Marks
Total 70
● Digital Footprints
● Digital Society and Netizen: net etiquettes, communication etiquettes, social media
etiquettes
● Data Protection: Intellectual property rights (copyright, patent, trademark), violation
of IPR (plagiarism, copyright infringement, trademark infringement), open source
software and licensing (Creative Commons, GPL and Apache)
● Cyber Crime: definition, hacking, eavesdropping, phishing and fraud emails,
ransomware, cyber trolls, cyber bullying
● Cyber safety: safely browsing the web, identity protection, confidentiality
● Malware: viruses, trojans, adware
● E-waste management: proper disposal of used electronic gadgets.
● Information Technology Act (IT Act)
● Technology and society: Gender and disability issues while teaching and using
computers
4. Practical
Python Programming
* 12345 A
** 1234 AB
*** 123 ABC
**** 12 ABCD
***** 1 ABCDE
● Write a program to input the value of x and n and print the sum of the following
series:
⮚ 1 + 𝑥 + 𝑥2 + 𝑥3 + 𝑥4 + ⋯ 𝑥n
⮚ 1 − 𝑥 + 𝑥2 − 𝑥3 + 𝑥4 − ⋯ 𝑥n
⮚ x2 x3 x4 xn
𝑥+ + + +⋯
2 3 4 n
⮚ x2 x3 x4 xn
𝑥+ + + +⋯
2! 3! 4! n!
1. Prerequisites
Computer Science- Class XI
2. Learning Outcomes
3. Distribution of Marks:
2 Computer Networks 10
3 Database Management 20
Total 70
5. Practical
Marks
[Link] Unit Name
(Total=30)
Lab Test:
1 1. Python program (60% logic + 20% 8
documentation + 20% code quality)
Report file:
Minimum 15 Python programs.
SQL Queries – Minimum 5 sets using
2 7
one table / two tables.
Minimum 4 programs based on
Python – SQL connectivity
4 Viva voce 3
Python Programming
● Read a text file line by line and display each word separated by a #.
● Read a text file and display the number of vowels/consonants/uppercase/lowercase
characters in the file.
● Remove all the lines that contain the character 'a' in a file and write it to another
file.
● Create a binary file with name and roll number. Search for a given roll number and
display the name, if not found display appropriate message.
● Create a binary file with roll number, name and marks. Input a roll number and
update the marks.
● Write a random number generator that generates random numbers between 1 and
6 (simulates a dice).
● Write a Python program to implement a stack using list.
● Create a CSV file by entering user-id and password, read and search the password
for given userid.
Database Management
● Create a student table and insert data. Implement the following SQL commands on
the student table:
o ALTER table to add new attributes / modify data type / drop attribute
o UPDATE table to modify data
o ORDER By to display data in ascending / descending order
o DELETE to remove tuple(s)
o GROUP BY and find the min, max, sum, count and average
● Similar exercise may be framed for other cases.
● Integrate SQL with Python by importing suitable module.
8. Project
The aim of the class project is to create something that is tangible and useful using
Python file handling/ Python-SQL connectivity. This should be done in groups of two to
three students and should be started by students at least 6 months before the
submission deadline. The aim here is to find a real world problem that is worthwhile to
solve.
Students are encouraged to visit local businesses and ask them about the problems that
they are facing. For example, if a business is finding it hard to create invoices for filing
GST claims, then students can do a project that takes the raw data (list of transactions),
groups the transactions by category, accounts for the GST tax rates, and creates
invoices in the appropriate format. Students can be extremely creative here. They can
use a wide variety of Python libraries to create user friendly applications such as games,
software for their school, software for their disabled fellow students, and mobile
applications, of course to do some of these projects, some additional learning is required;
this should be encouraged. Students should know how to teach themselves.
The students should be sensitized to avoid plagiarism and violations of copyright issues
while working on projects. Teachers should take necessary measures for this.
CBSE Additional Practice Question Paper
Class: XII Session: 2023-24
Computer Science (083)
General Instructions:
Please check this question paper contains 35 questions.
The paper is divided into 5 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.
a. per%marks
b. _for
c. While
d. true
2 What is the correct way to add an element to the end of a list in 1
Python?
a. [Link](element)
b. [Link](element)
c. [Link](element)
d. [Link](element)
3 What will be the output of 1
print("Welcome To My Blog"[2:6] + "Welcome To My
Blog"[5:9])
a. Lcomme
b. lcomme T
c. lcomme To
d. lcomme
4 Which of the following statements is false? 1
a. Statement 1
b. Statement 2
c. Statement 3
d. Statement 4
6 Which pickle module method is used to write a Python object to a 1
binary file?
a. save()
b. serialize()
c. store()
d. dump()
7 Given the following dictionaries 1
dict_student = {"rno" : "53", "name" : 'Rajveer Singh'}
dict_marks = {"Accts" : 87, "English" : 65}
a. dict_student + dict_marks
b. dict_student.add(dict_marks)
c. dict_student.merge(dict_marks)
d. dict_student.update(dict_marks)
8 Which of the following is not a component of the math module in 1
Python?
a. ceil()
b. mean()
c. fabs()
d. pi
9 What will be the output of the following code? 1
L=["One , Two", "Three", "Four"]
print(len(L)/2*len(L[0]))
a. 6.5
b. 13
c. 13.5
d. 6.0
10 Expand the following terms: 1
(i) PPP
(ii) VoIP
11 Which SQL operator performs pattern matching? 1
a. BETWEEN operator
b. LIKE operator
c. EXISTS operator
d. =
2
12 Which Python function is used for displaying only one result set from 1
SQL table in a database?
a. fetch1()
b. fetchno()
c. fetchall()
d. fetchone()
13 Which of the following file opening mode in Python, generates an 1
error if the file does not exist?
a. a
b. r
c. w
d. w+
14 The correct syntax of seek() is: 1
a. file_object.seek(offset [, reference_point])
b. seek(offset [, reference_point])
c. seek(offset, file_object)
d. seek.file_object(offset)
15 Which of the following statements is false? 1
a. FTP
b. PPP
c. Telnet
d. SMTP
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
17 Assertion (A): For changes made to a variable defined within a 1
function to be visible outside the function, it should be declared as
global.
Reasoning (R): Variables defined within a function are local to that
function by default, unless explicitly specified with the global
keyword.
18 Assertion (A): A binary file in python is used to store collection 1
objects like lists and dictionaries that can be later retrieved in their
original form using pickle module.
3
Reasoning (A): Binary files are just like normal text files and can be
read using a text editor like Notepad.
Q No. Questions Marks
Section-B (14 Marks)
19 Write two advantages and two disadvantages of circuit switching. 2
OR
Differentiate between Web server and web browser. Write the names
of any two web browsers.
20 Rewrite the following code in Python after removing all the syntax 2
errors. Underline each correction done in the code.
L = [5,10,15,1]
G = 4
def Change(X):
global G
N=len(X)
for i in range(N):
X[i] += G
Change(L)
for i in L:
print(i,end='$')
4
23 Write a suitable Python statement for each of the following tasks 2
using built-in functions/methods only:
i To delete an element Mumbai:50 from Dictionary D.
ii To display words in a string S in the form of a list
OR
Write a Python Program to display alternate characters of a string
my_str.
For example, if my_str = "Computer Science"
The output should be Cmue cec
24 Differentiate between % (percentage) and _(underscore) characters 2
used with the LIKE operator in SQL with appropriate examples.
OR
Differentiate between DROP and DELETE commands in SQL with
appropriate examples.
25 Consider the following two commands with reference to a table, 2
named Employee having a column named Department:
(a) Select count(Department) from Employee;
(b) Select count(*) from Employee;
TABLE : BOOK
CODE BNAME TYPE
F101 The priest Fiction
L102 Easy Python Programming
C101 Juman Ji Thriller
F102 Untold Story Fiction
C102 War Stories Comic
Table: MEMBER
MNO MNAME CODE ISSUEDATE
M101 SNEH SINHA L102 2022-10-13
M103 SARTHAK F102 2021-02-23
M102 SARA KHAN C101 2022-06-12
(b) Write the output of the queries (i) to (iv) based on the table
Table: Employee
EID Name DOB DOJ Salary Project
E01 Ranjan 1990-07-12 2015-01-21 150000 P01
E02 Akhtar 1992-06-21 2015-02-01 125000 P04
E03 Muneera 1996-11-15 2018-08-19 135000 P01
E04 Alex 1991-10-25 2018-10-19 75000 P02
E05 Satyansh 1993-12-16 2018-10-19 85000 P04
5
i SELECT NAME, PROJECT FROM EMPLOYEE ORDER BY NAME DESC;
ii SELECT NAME, SALARY FROM EMPLOYEE WHERE NAME LIKE 'A%';
iii SELECT NAME, DOJ FROM EMPLOYEE WHERE SALARY BETWEEN
100000 AND 200000;
iv SELECT * FROM EMPLOYEE WHERE PROJECT = 'P01';
27 (a) Consider the following tables – FACULTY and COURSES : 3
Table: FACULTY
FID FNAME LNAME JOINDATE SALARY
F01 Anishma Garg 2000-12-14 32000
F03 Bhumi Goel 2001-08-10 15000
F04 Neha Verma 2000-05-17 27000
F05 Meenu Sharma 2006-07-11 30000
Table: COURSES
C_ID FID CNAME FEES
C11 F01 Grid Computing 40000
C12 F04 Python 17000
C13 F03 C++ 8000
C14 F04 Computer Network 15000
C15 F01 HTML 12000
C16 F05 Data Science NULL
6
Then the output should be
It's the appreciation for the love we're shown,
In moments big and small, it's truly known.
29 Navdeep creates a table RESULT with a set of records to maintain the 3
marks secured by students in Sem1, Sem2, Sem3, and their divisions.
After the creation of the table, he entered data of 7 students in the
table.
ADNO ROLLNO SNAME SEM1 SEM2 DIVISION
123 101 KARAN 366 410 I
245 102 NAMAN 300 350 I
128 103 ISHA 400 410 I
129 104 RENU 350 357 I
234 105 ARPIT 100 75 IV
187 106 SABINA 100 205 II
181 107 NEELAM 470 450 I
For example:
If the dictionary Stu_dict contains the following data:
Stu_dict ={5:(87,68,89), 10:(57,54,61), 12:(71,67,90),
14:(66,81,80), 18:(80,48,91)}
7
Q No. Questions Marks
Section-D (8 Marks)
31 Create a function maxsalary() in Python to read all the records 4
from an already existing file [Link] which stores the records
of various employees working in a department. Data is stored under
various fields as shown below:
E_code E_name Scale Salary
A01 Bijesh Mehra S4 65400
B02 Vikram Goel S3 60000
C09 Suraj Mehta S2 45300
…… …… …… ……
Function should display the row where the salary is maximum.
Note: Assume that all employees have distinct salary.
32 Consider a binary file '[Link]' that stores information 4
about products using tuple with the structure (ProductID,
ProductName, Quantity, Price). Write a Python function
expensiveProducts() to read the contents of
'[Link]' and display details of products with a price
higher than Rs. 1000. Additionally, calculate and display the total
count of such expensive products.
For example: If the file stores the following data in binary format
(1, 'ABC', 100, 5000)
(2, 'DEF', 250, 1000)
(3, 'GHI', 300, 2000)
then the function should display
Product ID: 1
Product ID: 3
Total expensive products: 2
Q No. Questions Marks
Section-E (15 Marks)
33 Fun Media Services Ltd is an event planning organization. It is 5
planning to set up its India campus in Mumbai with its head office in
Delhi. The Mumbai campus will have four blocks/buildings -
ADMIN, DECORATORS, FOOD, and MEDIA.
You as a network expert need to suggest the best network-related
solutions for them to resolve the issues/problems mentioned in points
(i) to (v), keeping in mind the distances between various
blocks/buildings and other given parameters.
8
Shortest distance between various buildings:
FROM – TO DISTANCE
ADMIN TO DECORATORS 90 meters
ADMIN TO MEDIA 75 meters
ADMIN TO FOOD 50 meters
DECORATORS TO FOOD 65 meters
DECORATORS TO MEDIA 50 meters
FOOD TO MEDIA 45 meters
DELHI Head Office to MUMBAI 1475 KM
Campus
9
Write a user-defined function, findBook(price), that accepts
price as parameter and displays all those records from the
binary file [Link] which has a book price more than or equal
to the price value passed as a parameter.
35 i. Define the term constraint with respect to RDBMS. Give a 5
suitable example.
ii. Sameera maintains a database named STORE which contains a
table named ITEM with the structure given below:
• Ino(Item number )- integer
• Iname(Item Name) – string
• Price (Item Price) – float
• Discount (Discount) – float
Note the following to establish connectivity between Python
and MySQL:
• Username - root
• Password - tiger
• Host - localhost
Help her to remove the record from the table ITEM for a particular
value of item name input by the user.
import [Link] as mysql
con1= [Link](host='localhost', user='root', password=
'__', database='STORE') #Statement-1
mycursor = ________ #Statement-2
item_name = input("Enter the Item name to remove the record : ")
query = ______________ #Statement-3
[Link](query)
con1.____ #Statement-4
print('Data Deleted successfully')
[Link]()
11
Class: XII
Subject: COMPUTER SCIENCE
Q. No. 1 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 '[Link]' (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']
[Link](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
[Link](rec)
stuwriter. _____ (data) #Statement-5
[Link]()
i. Identify the suitable code for blank space in line marked as Statement-1.
a) csv file
b) CSV
c) csv
d) Csv
Q. No. 2 Amritya Seth is a programmer, who has recently been given a task to write a
python code to perform the following binary file operations with the help of
two user defined functions/modules:
He has succeeded in writing partial code and has missed out certain
statements, so he has left certain queries in comment lines. You as an expert
of Python have to provide the missing statements and other related queries
based on the following code of Amritya.
Answer any four questions (out of five) from the below mentioned questions.
import pickle
def AddStudents():
____________ #1 statement to open the binary file to
write data
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
____________ #2 statement to write the list L
into the file
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
[Link]()
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("[Link]","rb") as F:
while True:
try:
____________ #3 statement to read
from the file
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent =
",R[2])
Countabove75+=1
except:
break
if Countabove75==0:
print("There is no student who has
percentage more than 75")
average=Total/Countrec
print("average percent of class = ",average)
AddStudents()
GetStudents()
i. Which of the following commands is used to open the file “[Link]”
for writing only in binary format? (marked as #1 in the Python code)
a. F= open("[Link]",'wb')
b. F= open("[Link]",'w')
c. F= open("[Link]",'wb+')
d. F= open("[Link]",'w+')
Correct Answer : a
v. Which of the following statements correctly explain the function of seek()
method?
a. tells the current position within the file.
b. determines if you can move the file position or not.
c. indicates that the next read or write occurs from that position in a file.
d. moves the current file position to a given specified position
Correct Answer : d
Q. No. 3 Krrishnav is looking for his dream job but has some restrictions. He loves Delhi
and would take a job there if he is paid over Rs.40,000 a month. He hates
Chennai and demands at least Rs. 1,00,000 to work there. In any another
location he is willing to work for Rs. 60,000 a month. The following code
shows his basic strategy for evaluating a job offer.
Code:
pay= _________
location= _________
if location == "Mumbai":
print ("I’ll take it!") #Statement 1
elif location == "Chennai":
if pay < 100000:
print ("No way") #Statement 2
else:
print("I am willing!") #Statement 3
elif location == "Delhi" and pay > 40000:
print("I am happy to join") #Statement 4
elif pay > 60000:
print("I accept the offer") #Statement 5
else:
print("No thanks, I can find something
better")#Statement 6
On the basis of the above code, choose the right statement which will be
executed when different inputs for pay and location are given.
i. Input: location = "Chennai”, pay = 50000
a. Statement 1
b. Statement 2
c. Statement 3
d. Statement 4
Correct Answer : ii. Statement 2
ii. Input: location = "Surat" ,pay = 50000
a. Statement 2
b. Statement 4
c. Statement 5
d. Statement 6
a Statement 1
b. Statement 2
c. Statement 4
d. Statement 6
Q. No. 4 Consider the following code and answer the questions that follow:
Book={1:'Thriller', 2:'Mystery', 3:'Crime', 4:'Children
Stories'}
Library ={'5':'Madras Diaries','6':'Malgudi Days'}
i. Ramesh needs to change the title in the dictionary book from ‘Crime’ to ‘Crime
Thriller’. He has written the following command:
Book[‘Crime’]=’Crime Thriller’
But he is not getting the answer. Help him choose the correct command:
a. Book[2]=’Crime Thriller’
b. Book[3]=’Crime Thriller’
c. Book[2]=(’Crime Thriller’)
d. Book[3] =(‘Crime Thriller’)
Correct Answer: b
ii. The command to merge the dictionary Book with Library the command would
be:
a. d=Book+Library
b. print(Book+Library)
c. [Link](Library)
d. [Link](Book)
Correct Answer: d
iii. What will be the output of the following line of code:
print(list(Library))
a. [‘5’,’Madras Diaries’,’6’,’Malgudi Days’]
b. (‘5’,’Madras Diaries’,’6’,’Malgudi Days’)
c. [’Madras Diaries’,’Malgudi Days’]
d. [‘5’,’6’]
Correct Answer: d
iv. In order to check whether the key 2 is present in the dictionary Book, Ramesh
uses the following command:
2 in Book
He gets the answer ‘True’. Now to check whether the name ‘Madras Diaries’
exists in the dictionary Library, he uses the following command:
‘Madras Diaries’ in Library
But he gets the answer as ‘False’. Select the correct reason for this:
a. We cannot use the in function with values. It can be used with keys only.
b. We must use the function [Link]() along with the in operator
c. We can use the [Link]() function instead of the in operator
d. Both b and c above are correct.
Correct Answer: b
v. With reference to the above declared dictionaries, predict the output of the
following code fragments
Code 1 Code 2
Library=Book Library=[Link]()
[Link](2) [Link](2)
print(Library) print(Library)
print(Book) print(Book)
a) Code 1 Code 2
{1: 'Thriller', 2: {1: 'Thriller', 3:
'Mystery', 3: 'Crime', 'Crime', 4: 'Children
4: 'Children Stories'} Stories'}
{1: 'Thriller', 2: {1: 'Thriller', 3:
'Mystery', 3: 'Crime', 'Crime', 4: 'Children
4: 'Children Stories'} Stories'}
b) Code 1 Code 2
{1: 'Thriller', 3:
'Crime', 4: 'Children
{2:’Mystery’} Stories'}
{1: 'Thriller', 2: {1: 'Thriller', 3:
'Mystery', 3: 'Crime', 'Crime', 4: 'Children
4: 'Children Stories'} Stories'}
c) Code 1 Code 2
{1: 'Thriller', 3: {1: 'Thriller', 3:
'Crime', 4: 'Children 'Crime', 4: 'Children
Stories'} Stories'}
{1: 'Thriller', 3: {1: 'Thriller', 2:
'Crime', 4: 'Children 'Mystery', 3: 'Crime', 4:
Stories'} 'Children Stories'}
d) Code 1 Code 2
{1: 'Thriller', 3: {1: 'Thriller', 3:
'Crime', 4: 'Children 'Crime', 4: 'Children
Stories'} Stories'}
{1: 'Thriller', 2: {1: 'Thriller', 3:
'Mystery', 3: 'Crime', 'Crime', 4: 'Children
4: 'Children Stories'} Stories'}
Correct Answer: c
Q. No. 5 In a Database, there are two tables with the instances given below:
Table: STUDENTS
ADMNO NAME CLASS SEC RNO ADDRESS PHONE
1211 MEENA 12A D 4 A-26 3245678
1212 VANI 10A D 1 B-25 5456789
1213 MEENA 12B A 1 NULL NULL
1214 KARISH 10B B 3 AB-234 4567890
Table: SPORTS
ADMNO GAME COACHNAME GRADE
1215 CRICKET MR. RAVI A
1213 VOLLEYBALL MR. AMANDEEP B
1211 VOLLEYBALL MR. GOVARDHAN A
1212 BASKET BALL MR TEWARI B
i. Choose the command to display name and game of those students whose
address is available in students’ table.
Correct Answer:
a. ALTER TABLE STUDENTS DROP PHONE;
iii. Choose the command to display Name of the students who are studying in class
12 and their corresponding Coach names
Correct Answer:
a. SELECT NAME, COACHNAME FROM STUDENTS,SPORTS WHERE
CLASS LIKE “12%” AND [Link]=[Link] ;
iv. which two select queries will give the same output
Correct Answer :
a. SELECT COUNT(*) FROM STUDENTS,SPORTS WHERE
GAME=”VOLLEYBALL” AND [Link]=[Link]
;
B1 B4
B2 B3
i. Suggest the most appropriate topology for the connections between the blocks.
a. Ring topology
b. Star topology
c. Mesh topology
d. Bus topology
Correct Answer: b. Star topology
ii. The company wants internet accessibility in all the blocks. The suitable and
cost-effective technology for that would be:
a. Satellite
b. Lease line
c. Telephone line
d. Broadband
iii. Which one of the following devices will you suggest for connecting all the
computers with in each of their blocks?
a. Switch/Hub
b. Modem
c. Telephone
d. Repeater
Q. No. 7 Millions of computer science students have taken a course on algorithms and
data structures, typically the second course after the initial one introducing
programming. One of the basic data structures in such a course is the stack. The
stack has a special place in the emergence of computing as a science, as argued
by Michael Mahoney, the pioneer of the history of the theory of computing.
The Stack can be used in many computer applications, few are given below:
a) In recursive function
b) When function is called.
c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix
to Infix, Prefix to Infix.
In Stack, insertion operation is known as Push whereas deletion operation is
known as Pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Correct Answer : d. 2
iii. Fill the statement 3, to check the stack is empty.
a. Country=[]
b. [Link]()
c. len(country)==0
d. No of the above
Correct Answer : c. len(country)==0
iv. Fill the statement 4, to delete an element from the stack.
a. pop(1)
b. pop()
c. del country[1]
d. [Link](1)
Q. No. 8 Arun, during Practical Examination of Computer Science, has been assigned
an incomplete search() function to search in a pickled file [Link]. The File
[Link] is created by his Teacher and the following information is known
about the file.
• File contains details of students in [roll_no,name,marks] format.
• File contains details of 10 students (i.e. from roll_no 1 to 10) and
separate list of each student is written in the binary file using dump().
Arun has been assigned the task to complete the code and print details of roll
number 1.
def search():
f = open("[Link]",____)
#Statement-1
____: #Statement-2
while True:
rec = pickle.____
#Statement-3
if(____): #Statement-4
print(rec)
except:
pass
____ #Statement-5
Correct Answer: c) rb
ii. Identify the suitable code to be used at blank space in line marked as Statement-
2
a) if(rec[0]==1)
b) for i in range(10)
c) try
d) pass
Q. No. 9 Radha Shah is a programmer, who has recently been given a task to write a
python code to perform the following CSV file operations with the help of two
user defined functions/modules:
import csv
def CSVOpen():
with open('[Link]','______',newline='') as csvf:
#Statement-1
cw=______ #Statement-2
______ #Statement-3
[Link](['Rapunzel','Jack',300])
[Link](['Barbie','Doll',900])
[Link](['Johnny','Jane',280])
def CSVRead():
try:
with open('[Link]','r') as csvf:
cr=______ #Statement-4
for r in cr:
if ______: #Statement-5
print(r)
except:
print('File Not Found')
CSVOpen()
CSVRead()
You as an expert of Python have to provide the missing statements and other
related queries based on the following code of Radha.
Answer any four questions (out of five) from the below mentioned questions.
i. Choose the appropriate mode in which the file is to be opened in append mode
(Statement 1)
a. w+
b. ab
c. r+
d. a
Correct Answer: d. a
ii. Which statement will be used to create a csv writer object in Statement 2.
a. [Link](csvf)
b. [Link](csvf)
c. [Link]()
d. [Link](csvf)
Q. No. 10 Ankita is writing a program to perform some operations in Queue. She has
created three Insert_in_Queue(Student), Delete_from_Queue(Student) and
Print_Queue(Student) methods/functions in Python to add a new Student name,
delete a Student name and print list of student from a queue, considering them
to act as insert, delete and print operations of the Queue data structure. She is
not getting the desired result. Help her to get the desired result from the given
python code.
def Insert_in_Queue(queue):
a=input("enter student name: ")
queue.____________ # Statement-1
def Print_Queue(queue):
if not ________: #Statement-4
print(queue[__:___ ]) # Statement-5
i. What Ankita should write to complete the Statement-1 to store the student
name?
a. [Link](a)
b. queue=append(a)
c. [Link]=a
d. append(a).queue
Q. No. 11 Priyank is a software developer with a reputed firm. He has been given the task
to computerise the operations for which he is developing a form which will
accept customer data as follows:
i. The DATA TO BE ENTERED IS :
a. Name
b. Age
c. Items bought( all the items that the customer bought)
d. Bill amount
Correct Answer :
i. Choose the most appropriate data type to store the above information
in the given sequence.
a. string, tuple, float, integer
b. string, integer, dictionary, float
c. string, integer, integer, float
d. string, integer, list, float
Correct Answer :
ii. Now the data of each customer needs to be organised such that the
customer can be identified by name followed by the age, item list and bill
amount. Choose the appropriate data type that will help Priyank accomplish
this task.
a. List
b. Dictionary
c. Nested Dictionary
d. Tuple
Correct Answer :
iii. Which of the following is the correct way of storing information of
customers named ‘Paritosh’ and ‘Bhavesh’ with respect to the option chosen
above?
a. [Link]= {‘Paritosh’:24,[‘Printed Paper’, ‘ Penstand’], 3409,
‘Bhavesh’: 45,[‘A4 Rim’,’Printer Cartridge’, ‘Pen Carton’, ‘Gift Wrap’],
8099.99 }
b. customers={‘Paritosh’:[24,[‘Printed Paper’, ‘ Penstand’], 3409],
‘Bhavesh’: [45,[‘A4 Rim’,’Printer Cartridge’, ‘Pen Carton’, ‘Gift Wrap’],
8099.99] }
c. [Link]= [‘Paritosh’:24,‘Printed Paper’, ‘ Penstand’, 3409,
‘Bhavesh’: 45,‘A4 Rim’,’Printer Cartridge’, ‘Pen Carton’, ‘Gift Wrap’,
8099.99 ]
d. customers=(‘Paritosh’:24,[‘Printed Paper’, ‘ Penstand’], 3409,
‘Bhavesh’: 45,[‘A4 Rim’,’Printer Cartridge’, ‘Pen Carton’, ‘Gift Wrap’],
8099.99 )
Correct Answer :
iv. In order to calculate the total bill amount for 15 customers, Priyank
Statement 1. must use a variable of the type float to store the sum.
Statement 2. may use a loop to iterate over the values
a. Both statements are correct.
b. Statement 1 is correct, but statemnt 2 is not.
c. Both statements ar incorrect.
d. Statement 1 is incorrect but statement 2 is correct.
Correct Answer :
Q. No. 12 Your teacher has given you a method/function FilterWords() in python which
read lines from a text file [Link], and display those words, which are
lesser than 4 characters. Your teachers intentionally kept few blanks in between
the code and asked you to fill the blanks so that the code will run to find desired
result. Do the needful with the following python code.
def FilterWords():
c=0
file=open('[Link]', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5
FilterWords()
i. Write mode of opening the file in statement-1?
a. a
b. ab
c. w
d. r
Correct Answer: d. r
ii. Fill in the blank in statement-2 to read the data from the file.
a. [Link]()
b. [Link]()
c. [Link]( )
d. readlines( )