Students must start practicing the questions from CBSE Sample Papers for Class 12 Computer Science with Solutions Set 2 are designed as per the revised syllabus.

CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions

Time Allowed: 3 hours
Maximum Marks: 70

General Instructions:

  • This question paper contains five sections, Section A to E.
  • All questions are compulsory.
  • Section A have 18 questions carrying 01 mark each.
  • Section B has 07 Very Short Answer type questions carrying 02 marks each.
  • Section C has 05 Short Answer type questions carrying 03 marks each.
  • Section D has 03 Long Answer type questions carrying 05 marks each.
  • Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35 against part c only.
  • All programming questions are to be answered using Python Language only.

Section – A

Question 1.
State True or False.
‘in’ is a logical operator in Python. [1]
Answer:
False

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 2.
Which of following is not a decision-making or selection statement? [1]
(A) if-elif statement
(B) for statement
(C) if -else statement
(D) if statement
Answer:
(B) for statement

Explanation:
A decision involves selecting from one of the two or more possible options. In programming, this concept of decision making or selection is implemented with the help of if..else statement

Question 3.
The for loop in Python is an ______________ [1]
(A) Entry Controlled Loop
(B) Exit Controlled Loop
(C) Both of the above
(D) None of the above
Answer:
(A) Entry Controlled Loop

Explanation:
An entry controlled loop has a control over entry in the loop in the form of a test condition, ‘for’ and ’while1 loop are entry controlled loop in python

Question 4.
What is the output when the following code is executed? [1]
print(r’\nhello”)
(A) a new line and hello
(B) \nhello
(C) the letter r and then hello
(D) Error
Answer:
(B) \nhello

Explanation:
Given code will give output \nhello
because \nhello is in double quotes preceded by r hence the actual meaning of \n is escaped and is treated as a character. Consider as string.

Commonly Made Error:
Students overlook r in the print statement.

Answering Tip:
Strings and their usage must be understood carefully.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 5.
Which type of bracket is used to define a list? [1]
(A) []
(B) ()
(C) {}
(D) <>
Answer:
(A) []

Explanation:
List is a type of container in data structure, which is used to store multiple data at the same time. Lists can be created to put the elements in square brackets []. The elements in the list are separated by the comma (,).

Question 6.
What do we call a function defined inside a class? [1]
(A) Module
(B) Class
(C) Another function
(D) Method
Answer:
(D) Method

Explanation:
when a function is defined inside a class it is called Method. A function is a named block of statements that can be invoked by its name.

Question 7.
Fill in the blank
_________________ are also known as positional arguments. [1]
(A) Keyword arguments
(B) Default arguments
(C) Required arguments
(D) Variable length arguments
Answer:
(C) Required arguments

Explanation:
Required arguments are also known positional argument. These arguments are the arguments passed to a function in correct positional order.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 8.
A relational database is a collection of ______________ [1]
(A) Attributes
(B) Tables
(C) Records
(D) Fields
Answer:
(B) Tables

Explanation:
In a relational database, all data is arranged in tables, which are made up of rows and columns

Question 9.
Which of the following option is the correct usage for the tell() of a file object? [1]
(A) It places the file pointer at a desired offset in a file
(B) It returns the entire content of a file
(C) It returns the byte position of the file pointer as an integer
(D) It tells the details about the file
Answer:
(C) It returns the byte position of the file pointer as an integer

Explanation:
tell() method can be used to get the position of File Handle. tell() method returns current position of file object. This method takes no parameters and returns an integer value. Initially file pointer points to the beginning of the file(if not opened in append mode).

Question 10.
Fill in the blank
A field of a table is termed as ____________ . [1]
(A) Row
(B) Attribute
(C) Key
(D) Tuple
Answer:
(B) Attribute

Explanation:
In RDBMS, columns or fields are termed as attributes

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 11.
How can you separate the content in a text file? [1]
(A) whitespace
(B) tab
(C) comma
(D) All of these
Answer:
(D) All of these

Explanation:
A text file can be sequence of characters consisting of alphabets, number and other special symbols. The content of text file can be separate by white space, tab and comma

Question 12.
Fill in the blank
____________ is not an aggregate function. [1]
(A) AVG
(B) MAX
(C) JOIN
(D) COUNT
Answer:
Option (C) is correct.

Explanation:
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

Question 13.
Fill in the blank
____________ switching technique follows the store and forward mechanism
(A) Circuit
(B) Message
(C) Packet
(D) All of these
Answer:
(B) Message

Explanation:
In message switching technique, no physical path is established between sender and receiver in advance. This technique follows store and forward mechanism

Question 14.
In the following list, which item has the index number of 3?
[“John”, “Harry”, “Jesse”, “John”, “Harry”, “Harry”] [1]
(A) “John”
(B) “Harry”
(C) “Jesse”
(D) “None of these”
Answer:
(A) “John”

Explanation:
Because indexing starts from 0. So, the 3rd item in the list is John.

Commonly Made Error:
Sometimes students start the index numbering from 1.

Answering Tip
Remember that indexing in python starts from 0 and negative indexing starts from -1.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 15.
Which method of cursor class is used to execute database function or stored procedure in Python ? [1]
(A) cursor.callprocedureCprocedurename’, [parameters,])
(B) cursor.callproc(‘procedurename’, [parameters,])
(C) cursor.callfunc(‘procedurename’, [parameters,])
(D) cursor.callfunction(‘procedurename’, [parameters,])
Answer:
(B) cursor.callproc(‘procedurename’, [parameters,])

Explanation:
The callproc() method calls the stored procedure. Parameters must contain one entry for each argument that the procedure that has been called expects.

Question 16.
____________ is the set of records that are retrieved after execution of SQL query over an established database [1]
connection.
(A) sqlresult
(B) resultset
(C) table
(D) tuple
Answer:
(B) resultset

Explanation:
The resultset refers to the logical set of records that are fetched from the database by executing an SQL query.

Assertion and Reason:
In the following questions, A statement of Assertion (A) is followed by a statement of Reason (R). Mark the correct choice as.
(A) Both A and R are true and R is the correct explanation of A.
(B) Both A and R are true and R is not correct explanation of A.
(C) A is true but R is false.
(D) A is false but R is true.

Question 17.
Assertion (A): Interactive mode allows execution of individual statement instantaneously.
Reason (R): Script mode allows us to write more than one instruction in a file called Python source code file that can be executed. [1]
Answer:
(B) Both A and R are true and R is not correct explanation of A.

Explanation:
To work in the interactive mode, we can simply type a Python statement on the > > > prompt directly. As soon as we press enter, the interpreter executes the statement and displays the result(s).
In the script mode, we can write a Python program in a file, save it and then use the interpreter to execute it. Python scripts are saved as files where file name has extension “.py”.

Question 18.
Assertion (A): The while statement executes a block of code repeatedly as long as the control condition of the loop is false.
Reason (R): If the condition of the while loop is initially false, the body is not executed even once.
Answer:
(D) A is false but R is true.

Explanation:
The while statement executes a block of code repeatedly as long as the control condition of the loop is true. The control condition of the while loop is executed before any statement inside the loop is executed. After each iteration, the control condition is tested again and the loop continues as long as the condition remains true. The statements within the body of the while loop must ensure that the condition eventually becomes false; otherwise the loop will become an infinite loop, leading to a logical error in the program.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Section – B

Question 19.
Identify the errors(s) in the code and write the correct code. [1]
def describe intelligent life form ():
height = input (“Enter the height”)
raw_input (“Is it correct?”)
weight = input (“Enter the weight”)
favourite-game = input (“Enter favourite game”)
print (“your height”, height, ‘and weight’, weight)
print (“and your favourite game is”, favouritism,’.’)
Answer:
Line 1. Function name contains spaces. Function name should be a valid Python identifier with no spaces in between. 3. here, no variable is defined to obtain value being input. Lines 4 and 6 are badly indented; being part of same function, those should be at the same indentation level as that of lines 2, 3, 5 and 7.

And also, variable favourite-game in line 5 is an invalid identifier as it contains a hyphen, Instead it should have been an underscore.
The corrected code is:

def describeintelligentlifeform( ):
height = input ("Enter the height")
ans= raw_input ("Is it correct?") weight = input ("Enter the weight")
favourite_game = input ("Enter favourite game")
print ("your height", height, 'and weight', weight)
print ("and your favourite game is", favourite_game, '.')

Commonly Made Error:
Students Ignore the Indentation And Variable Naming Conventions

Answering Tip:
Remember the rules of indentation and variable naming

Question 20.
Write any two differences between twisted pair cable and coaxial cable. [2]
OR
18 Gbps is equal to how many bits per second?
Answer:

Twisted pair cable Co-axial cable
(i) Their bandwidth is not as high as co-axial cables. (i) It has high bandwidth.
(ii) A twisted pair consists of two copper wires twisted around each other (each has its own insulation around it) like a double helix. (ii) A coaxial cable consists of a copper wire core covered by an insulating material and a layer of conducting material over that

OR

18 Gbps = 18 *210 mbps
= 18 * 210 210 Kbps
= 18* 210 210 210 bps
= 18* 230 kits per second.

Commonly Made Error:
students don’t have proper information about various types of transmission media.

Answering Tip:
different transmission media should be learned thoroughly

Question 21.
(a) Write the output of the following Python code: [l]
i=5
j = 7
x=0
i=i+ (j-i)
x= j +i
print(x,”:”,i)
j =j **2
x= j +i
i=i+1
print(i,”:” , j )
Answer:
14 : 78 : 49

(b) What is the output of the following code [1]
my_list = [“Python”, “Language”]
print(“_”.join(my_list))
Answer:
Python-Language

Commonly Made Error:
Students just write down the output

Answering Tip:
correct format of output should be given.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 22.
Consider the tables FACULTY and COURSES with structure as follows.

FACULTY COURSES
F_ID C_ID
FName F_ID
LName Cname
Hiredate Fees
Salary

Write Python codes to display details of these faculties whose salary is greater than 12000 [2]
Answer:

import MySQLdb
db = MySQLdb.connect('localhost' , ' F acAdmin','FacAdmin@pwd','college')
cursor=db.cursor()
sql="""select* from Faculty where salary>%F""",
search_value=(12000, )
try:
cursor.execute(sql,search_value)
result=cursor.fetchall()
print("ID, Name, Hiredate")
for row in result:
ID=row[0]
Name=row[1]+" "+row[2]
Hiredate=row[2]
print (ID, Name, Hiredate)
print (cursor.rowcount, "Records found")
except:
print ("Error: can't Fetch records")
cursor.close ()
db.close ()

Question 23.
(a) Assume that 50 employees are working in an organization. Each employee has been allotted a separate
workstation to work. In this way, all computers are connected through the server and all these workstations are distributed over two floors. In each floor, all the computers are connected to a switch. Identify the type of network?
(b) Given below are two addresses.
(i) http:/Avww.abc.com/index.htm
(ii) 182.68.9.165
Identify which one of the above is an IP address and which one is a URL?
Answer:
(a) LAN(Local Area Network)
(b) (i) URL
(ii) IP address

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 24.
Suppose the content of “Rhymes.txt” is Good Morning Madam
What will be the output of the following Python code?
F = open (“Rhymes.txt”)
L = F.read ( ) .split ( )
for W in L:
if W.lower()== W [::-1] .lower() :
print(W)
OR
Suppose the content of “Rhymes.txt” is
Hickory Dickory Dock
The mouse went up the clock
What will be the output of the following Python code?
F = open(“Rhymes.txt”)
1 = F.readlines()
x = [“the”,”ock”]
for i in L:
for w in i.split():
if w in x:
print (w, end = “*”)
Answer:
Madam
OR
the*

Commonly Made Error:
Don’t Know String Slicing

Answering Tip:
Correct usage of SLICING should be learnt.

Question 25.
Write the full forms of DDL and DML. Write any two commands of DML in SQL. [2]
OR
Differentiate between char(n) and varchar(n) data types with respect to databases.
Answer:
DDL – Data Definition Language
DML – Data Manipulation Language
Any two out of INSERT, DELETE, UPDATE

OR

Char (n):

  • stores a fixed length string between 1 and 255 characters
  • if the value is of smaller length, adds blank space
  • some space is wasted varchar (n):
  • stores a variable length string
  • no blanks are added even if value is of smaller length
  • no wastage of space

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Section – C

Question 26.
(a) write appropriate sql statement to display item names and rates of the products having their names ending WITH soap
(b) Write the output of the queries (i) to (iv) based on the table, Furniture given below:
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 1
(i) SELECT SUM (DISCOUNT) FROM FURNITURE WHERE COST> 15000;
(ii) SELECT MAX (DATEOFPURCHASE)FROM FURNITURE;
(iii) SELECT * FROM FURNITURE WHERE DISCOUNTS AND FID LIKE ” T%’
(iv) SELECT DATEOFPURCHASE FROM FURNITURE WHERE NAME IN (“Dining Table”, “Console Table”); [1+2=3]
Answer:
(a) SELECT item_name, rate FROM product
WHERE item_name LIKE ‘%soap’

(b) (i) 29
(ii) 01-Jul-2021
(iii) T010 Dining Table 10-Mar-2020 51,000 5
T006 Console Table 17-Nov-2019 15,000 12
(iv) 10-Mar-2020
17-Nov-2019

Question 27.
(a) Write a statement in Python to perform the following operations:
(i) To open a text file “MYPET.TXT” in write mode.
(ii) To open a text file “MYPET.TXT” in read mode.
(b) Write a function that:
Asks the user to input diameter of circle in inches. [3]
OR
Write a function in Python that counts the number of “Me” or “My” words present in a text file “STORY.TXT”.
If the “STORY.TXT” contents are as follows:
My first book
was Me and
My Family. It
gave me
chance to be
Known to the
world.
The output of the function should be:
Count of Me/My in file:
Answer:
(a) (i) f1=open (“MYPET.TXT”, ‘w’)
(ii) f2=open (“MYPET.TXT”, ‘r’)

(a) (i) f1 = open (“MYPET.TXT”, ‘W’)
(ii) f2 = open (“MYPET.TXT”, ‘r’)

(b) import math
def arsa_/circle ():
diameter= float (raw_input ("Enter the diameter in Inches"))
radius = diameter/2 area_circle_inches = (math.pi) * (radius * * 2)
print ("The area of circle", area_ circle_ inches ,"sq inch")
return (area_circle_inches)

OR

def displayMeMy():
num=0
f=open("story.txt","r+")
N=f.read()
M=N.split()
for x in M:
if x.lower()=="me" or x.lower()==
"my" :
num=num+1
f.close ()
print("Count of Me/My in file:",num)

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 28.
(a) Consider the table, MOVIEDETAILS given below:
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 2
Identify the degree and cardinality of the table.

(b) Consider the following tables EMPLOYEE and DEPARTMENT and answer (i) and (ii) parts.
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 3

Table: DEPARTMENT

DepCde DepName DepHead
101 ACCOUNTS Rajiv Kumar
103 HR P K Singh
119 IT Yogesh Kumar
123 RESEARCH Ajay Dutta

(i) Write SQL commands for the following statements:
(A) To display all DepName along with the DepCde in descending order of DepCde.
(B) To display the average age of Employees in DepCde as 103.

(ii) Give the output of the following SQL queries:
(A) SELECT COUNT (DISTINCT DepCde) FROM EMPLOYEE;
(B) SELECT MAX(JoinDate), MIN (JoinDate) FROM EMPLOYEE; [3]
Answer:
(a) DEGREE =5
CARDINALITY=6

(b) (i) (A) SELECT DEPNAME, DepCde FROM DEPARTMENT Order by DepCde DESC;
(B) SELECT AVG (Age) FROM EMPLOYEE Where DepCde=”103″;

(ii) (A) \(=\frac{\text { COUNT(DISTINCT DepCde) }}{4}\)
(B) \(\frac{\text { Max (JoinDate) }}{\text { 03-Mar-2010 }}\) \(\frac{\text { MIN (JoinDate) }}{\text { 25-Nov-2000 }}\)

Question 29.
Write a function that takes a list that is sorted in ascending order and a number as argument. The function should do the following:

  • Insert the number passed as argument in a sorted list.
  • Delete the number from the list. [3]

Answer:

from bisect import bisect
def listfunc(sortedlist,number):
insert_point = bisect (sortedlist, number)
sortedlist.insert(insert_point,number)
print ("List after Insertion")
print (sortedlist)
sortedlist.remove(number)
print ("List after Deletion")
print (sortedlist)
maxrange = input("Enter Count of numbers: ")
numlist=[]
flag=False
for i in range(0, maxrange):
numlist.append(input("?"))
numlist.sort()
number = input("Enter the number")
listfunc(numlist, number)

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 30.
What does the extend() function do? [3]
Evaluate the following Postfix notation of expression :
4,2, *,22,5,6,+/,-
OR
What is overflow situation in stack?
Write equivalent postfix expressions for the following infix expression:
a+b*d = (a+(b*d))
Answer:
The extend() method adds all the elements of an iterable to the end of the list.
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 4
So, final answer is 6.

OR

Overflow occurs in stack when one tries to push an item in stack that is full.
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 5

Section – D

Question 31.
ABC is professional consultancy company. The company is planning to set up their new offices in India with its hub at Bengaluru. As a network adviser, you have to understand their requirements and suggest them the best available solutions. Their queries are mentioned as (i) to (v) below: Physical Location of the blocks of ABC.
Human Resource Conference Finance
Block to Block Distances (int Mtr)

Block (From) Block (To) Distance
Human Resource Conference 110
Human Resource Finance 40
Conference Finance 80

Expected number of computers to be installed in each block:

Block Computer
Human Resource 25
Finance 120
Conference 90

(i) What will be the most appropriate block, where ABC should plan to install their server?
(ii) Which type of topology is best suited for above network?
(iii) What will be the best possible connectivity you will suggest to connect the new setup of offices in Chennai with its London based office.
(iv) Which device will be suggested by you to connect each computer in each of the buildings?
(v) The company wants internet accessibility in all the blocks. What would the suitable and cost-effective technology for that? [5]
Answer:
(i) Finance
(ii) Star topology
(iii) Satellite Link.
(iv) Switch
(v) Broadband

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 32.
(a) What will be the result of following functions?
(i) Unicode (3 + 2j)
(ii) Str (015)
(iii) Complex (3,2)
(iv) Long (5.7)
(b) Consider the table Teacher in which Tina wants to add two rows. For this, she wrote a program in which some code is missing. Help her to complete the following code.
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 6
(i) Which function will be filled in the blank at line2?
(ii) What should be come in the blank at the linel?
(iii) Which function will be filled in the blank at line3?
OR
What does the expression 2 + 3 * 4 result in ? give reasons.
Write Python code to create a table Faculty with following fields. Id, LastName, FirstName, Locationld, phone, rank, startdate Rank should be one of the following ASSO, FULL, ASST, INST
Answer:
(a) (i) u’3 + 2j’
(ii) ‘015’
(iii) 3 + 2j
(iv) 5L

(b) (i) commit
(ii) INTO
(iii) mycon.close()

OR

(a) Operator precedence rules make the expression to be interpreted as 2 + (3*4) hence the result is 14.

(b) import MySQLdb
db = MySQLIb.connect(”localhost”, “Fac”, “Fac24”, “lnstds”)
cursor = db.cursor()
cursor.execute(”DROP TABLE IF EXISTS FACULTY”)
sql = “”” Create Table Faculty(Id Number(3) PRIMARY KEY, LastName CHAR(30) NOT NULL,
FirstName CHAR(30) NOT NULL, Locationld Number(5), phone char(10), rank char(4) check (rank lN(‘ASSO’, ‘FULL’, ‘ASST’, ‘INST’))’ startdate DATE)”””
cursor.execute(sql)
db.close()

Question 33.
How will you open a text file btext.txt in write and read mode ?
A text file “PARA.txt” contains a paragraph. Write a function that searches for a given character and reports the number of occurrence of the character in the file. [5]
OR
Which module is used to rename or delete/remove a file from within a program?
Write a function to create a text file containing following data:
Neither apple nor pine are in pineapple. Boxing rings are square.
Writers write, but fingers don’t fing. Overlook and oversee are opposites. A house can bum up as it burns down. An alarm goes off by going on.
(i) Read back the entire file content using read() or readlines() and display on the screen.
(ii) Append more text of your choice in the file and display the content of file with line numbers prefixed to line.
(iii) Display last line of file.
(iv) Display first line from 10th character onwards
Answer:

file1 = open ("btext.txt",'r+')

def countchar( ):
fname = "PARA.txt"
count=0
c = raw_input("Enter the character to be search for")
with open(fname, 'r') as f:
for line in f:
for word in line:
for char in word:
if char.strip()==c:
count=count + 1
print ("No. of occurrences of",c,"=",count)

OR

os module is used to rename or delete/remove a file from within a program.

PROGRAM

fname="C:\Pavithra\Python27\story. txt"
# READING
try:
file =open (fname,'r')
lines=file . readlines ()
for line in lines:
print (line)
file . close ()
# Appending
file=open (fname, ' a' )
line=raw_input("Enter line to be appended")
file .write (' \n' )
file .write (line)
file . close ()
count=0
#DISPLAY WITH LINE NUMBERS
file=open (fname, ' r' )
lines=file . readlines ()
for line in lines:
count=count + 1
print (count,"\t",line)
file . close ()
#PRINTING LAST LINE OF THE FILE
file=open(fname, 'r' )
lines=file . readlines ()
num=len(lines)
Point(line [num-1])
#Point(line [num-l])
#PRINT FIRT LINE FROM THE 10TH CHARACTER
user=input("Enter line number to be displayed")
for line in lines:
count=count +1
if count==1:
print ("First line from 10th character is-", line[10:])
file . close ()
except:
print ("File Not Found")

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Section – E

Question 34.
Consider the following tables Activity and Coach and answer (i) and (ii) parts of this question:
CBSE Sample Papers for Class 12 Computer Science Set 2 with Solutions 7
Table: COACH

PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003

What all domain names are possible in attribute ACode? A
# fresh
(ii) Which keyword is used to sort the records of a table in descending order? [CBSE SQP – 2020]
(iii) Write SQL commands for the following statements:
(a) To display the names of all activities with their ACodes in descending order.
(b) To display sum of PrizeMoney for the Activities played in each of the Stadium separately [1+1+2=4]
(Option of Part (iii) Only)
OR
(iii) Give the output of the following SQL queries:
(a) SELECT COUNT (DISTINCT ParticipantsNum) FROM ACTIVITY;
(b) Select Max (ScheduleDate), Min (ScheduleDate) From Activity;
Answer:
(i) values of ACode in table Activity
(ii) DESC
(iii) (a) SELECT ACode, ActivityName FROM ACTIVITY ORDER BY ACode DESC;
(b) SELECT SUM(PrizeMoney) FROM ACTIVITY GROUP BY Stadium;
OR
(iii) (a) 3
(b) 19-Mar-200412-Dec-2003

Question 35.
Abhinav, an intern is Excel Pvt. Ltd, is developing a project using the cvs module in Python. He has partially developed the code as follows leaving out statements about which he is not very confident. The code also contains error in certain statements. Help him to find the answer of following questions to read the code to read the desired CSV File named “Employee.csv”

#CSV File Content
ENO, NAME, DEPARTMENT
E1, ROSHAN SHARMA, ACCOUNTS
E2, AASMA KHALID, PRODUCTION
E3, AMRIK GILL, MARKETING
E4, SARAH WILLIAMS, HUMAN RESOURCE
# incomplete Code With Errors
import CSV #Statement-l
with open(_____' _____' newline=' ') as File: #Statement-2
ER = csv. _____ #Statement-3
for R in range (ER): #Statement-4
if _____ ==’ACCOUNTS": #Statement-5
print (_____'_____) #Statement-6

(a) Abhinav gets an Error for the module name used in Statement. 1. What should he write in place of CSV to
import the correct module? [1]
(b) Identify the missing code for blank spaces in the line marked as Statement-2 to open the mentioned file. [1]
(c) Abhinav gets as Error in Statement-4. What should he write to correct the statement? [2]
Answer:
(i) CSV
(ii) “Employee.csv’V’r”
(iii) for R in ER: