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

CBSE Sample Papers for Class 12 Computer Science Set 3 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. [1]
The default extension of a python file is .py.
Answer:
True

Explanation:
The default extension of a Python file is .py.

Question 2.
In a Python program, a control structure: [1]
(A) Defines program-specific data structures
(B) Directs the order of execution of the statements in the program
(C) Dictates what happens before the program starts and after it terminates
(D) None of the above
Answer:
Option (B) is correct.

Explanation:
In a Python program, a control structure directs the order of execution of the statements in the program. Various types of control structure are sequence (simple program), selection (if, if-else, if-elif-else) and iteration (for, while).

Question 3.
Which one of the following is a valid Python if statement: [1]
(A) if x > = 9
(B) if x > = 9)
(C) if (x = > 9)
(D) if x > = 9
Answer:
Option (A) is correct.

Explanation:
Syntax of if statement is: if condition: statement(s)

Commonly Made Error
Students overlook the semicolon in the given options.

Answering Tip
Learn the syntax of statements properly and check for the correct syntax.

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

Question 4.
Which of the following is/are compile time errors? [1]
(A) Syntax error
(B) Semantic error
(C) (A) and (B) both
(D) None of these
Answer:
Option (c) is correct.

Explanation:
All the errors that are detected and displayed by the compiler or interpreter are known as compile time errors, whenever the compiler displays an error, the program will not be executed. There are two categories of compile time errors

  • Syntax error
  • Semantic error

Question 5.
Given a tuple tup1 = (10,20,30,40, 50,60, 70,80, 90). [1]
What will be the output of print (tup1 [3:7:2])?
(A) (40,50,60,70,80)
(B) (40,50,60,70)
(C) [40,60]
(D) (40, 60)
Answer:
Option (D) is correct.

Explanation:
This expression will slice the given tuple starting with index position 3 and selecting every second element till index number 7(excluding element at index number 7.)

Commonly Made Error

  • Students include the element at last index position also in the output.
  • Practice slicing of sequences thoroughly.

Question 6.
What will be output of this expression? [1]
(A) pq
(B) rs
(C) pqrs
(D) pq12
Answer:
Option (A) is correct.

Explanation:
Concatenation operator (+) is used to merge or join two strings.

Question 7.
Fill in the blank
def Calc(X, Y=20):
For a function header as follows:
_________ call statement will give an Error ? [1]
(A) Calc(15,25)
(B) Calc(X=15,Y=25)
(C) Calc(Y=25)
(D) Calc(X=25)
Answer:
Option (C) is correct.

Explanation:
This statement will produce a type error because the first argument will be considered as missing.

TypeError:
Calc() missing 1 required positional argument: ‘x’

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

Question 8.
Which command is used to change some values in existing rows? [1]
(A) UPDATE
(B) INSERT
(C) ALTER
(D) ORDER
Answer:
Option (A) is correct.

Explanation:
UPDATE command specifies the rows to be changed using the WHERE clause and new data is specified using SET clause

Question 9.
Find the invalid identifier from the following. [1]
(A) name
(B) break
(C) section
(D) mark12
Answer:
Option (B) is correct.

Explanation:
As per identifier naming convention we can’t use any keyword as an identifier break is a keyword. So, it is invalid.

Question 10.
Fill in the blank: [1]
A RDBMS must comply with at least rules.
(A) 4
(B) 5
(C) 6
(D) 7
Answer:
Option (C) is correct.

Explanation:
According to E.F. Codd there are 12 rules for a database to be perfect RDBMS but no RDBMS can follow all these rules but it must comply with at least 6 rules.

Question 11.
Which of the following is not a correct Python statement to open a text file “Notes.txt” to write content into it? [1]
(A) F = open(‘Notes.txt’, ‘w’)
(B) F = open(‘Notes.txt’, ‘a’)
(C) F = open (‘Notes.txt’, ‘A’)
(D) F = open(‘Notes.txt’, ‘w+’)
Answer:
Option (C) is correct.
Explanation: Option C is invalid because ‘A’ is an invalid mode in Python.
‘w’ Opens a file for write mode.
‘a’ Opens a file for append mode
‘w+’ Opens a file for both writing and reading

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

Question 12.
Consider the following statement:
SELECT * FROM product ORDER BY rate _________, item name _________.
Which of the following option should be used to display the ‘rate’ from greater to smaller and ‘name’ in alphabetical order?
(A) ASC, DESC
(B) DESC, ASC
(C) Descending, Ascending
(D) Ascending, Descending
Answer:
Option (B) is correct.

Explanation:
For descending order, DESC keyword is used and for ascending order, ASC Keyword is used in SQL statement.

Question 13.
Fill in the blank
A network with all client computers and no server is called _________. [1]
(A) Networking
(B) Peer to Peer network
(C) Client Server network
(D) Any of them
Answer:
Option (B) is correct.

Explanation:
The peer-to-peer model (P2P model) is a non-hierarchical system of exchange, transfer or transmission. P2P is commonly spoken of in relation to networks. Peer-to-peer networking is a decentralized communications model in which each party has the same capabilities

Question 14.
Name the module that implements binary protocols for serializing and de-serializing a Python object structure. [1]
(A) pickle module
(B) unpickle module
(C) math module
(D) random module
Answer:
Option (A) is correct.

Explanation:
The pickle module is used for implementing binary protocols for serializing and de-serializing a Python object structure. The pickle module deals with binary files.

Question 15.
Mandatory arguments required to connect any database from Python : [1]
(A) Username, Password, Hostname, Database Name, Port. ‘
(B) Username, Password, Hostname.
(C) Username, Password, Hostname, Database Name.
(D) Username, Password, Hostname, Port.
Answer:
Option (C) is correct.

Explanation:
Username, Password, Hestname, Database name are mandatory arguments required to connect any database from python.

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

Question 16.
Which method of cursor class is used to fetch limited rows from the table? [1]
(A) cursor.fetchsize(SIZE)
(B) cursor.fetchmany(SIZE)
(C) cursor.fetchall(SIZE)
(D) cursor.fetchonly(SIZE)
Answer:
Option (B) is correct.

Explanation:
The fetchmany() method will return only the <n> number of rows from the resultset in the form of a tuple containing the records.

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): A function is a block of organized and reusable code that is used to perform a single, related action.
Reason (R): Function provides better modularity for your application and a high degree of code reusability. [1]
Answer:
Option (A) is correct.

Explanation:
A function is a block of organized and reusable code that is used to perform a single, related action, function provides better modularity for your application and a high degree of code _ re-usability. Function begin with the keyword def followed by function name and parenthesis ().

Question 18.
Assertion (A): Text file stores information in ASCII or Unicode characters.
Reason (R): In text file, there is no delimiter for a line. [1]
Answer:
Option (C) is correct.

Explanation:
Text file store information in ASCII or Unicode character. In text file, each line of text is terminated with a special character known as EOL (end of line) character.

Section – B

Question 19.
Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the code. [2]
Value = 30
for val in range(0,Value)
if val%4==0
print (val*4)
else if val%5==0:
print (val+3)
else
print(val+10)
Answer:
Value=3 0
for val in range(0,Value):# Error 1
if val%4==0:# Error 2
print (val*4)
elifval%5==0: # Error 3
print (val+3)
else:# Error 4
print(val+10)

Question 20.
Rearrange the following terms in increasing order of data transfer rates. [2]
Gbps, Mbps, Tbps, Kbps, bps
OR
Name any two transmission media best suitable for connecting to hilly areas.
Answer:
Bps, Kbps, Mbps, Gbps, Tbps 2
OR
(i) Microwave
(ii) Radio wave

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

Question 21.
(a) Consider following list for python language [2]
L=[13,3.45, “Tree”, Amar’, [10,8.91, “Apple”], 456]
The output of L[-2] will be.
(b) What will be the output of the following program.?
def increase (x):
a=a+x def f():
return a=10
print(a)
a=20
b=5
increase (b)
print(a)
Answer:
(a) [10,8.91,’Apple’]
Explanation:
As it is list within a list

(b) This code will produce an error as in line 2 there is no value of ‘a1 available to be used in RHS of the assignment statement.

Question 22.
Observe the following table carefully and write the names of the most appropriate columns, which can be considered as
(i) candidate keys and (ii) primary key [2]
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 1
Answer:
Candidate keys: Id, Product
Primary key: Id

Question 23.
(a) When a user browses a website, the web server sends a text file to the web browser. What is the name of this? [2]
(b) What is the purpose of server in a network ?
Answer:
(a) Cookies
(b) A server manages network resources in a network.

Question 24.
What possible output(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables FROM and TO. [2]
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#”)
(i) 10#40#70#
(ii) 30#40#50#
(iii) 50#60#70#
(iv) 40#50#70#
OR
What will be the output of the following Python code?
V = 25 def Fun(Ch):
V=50
print(V, end=Ch)
V *= 2
print(V, end=Ch)
print (V, end=”*”)
Fun(“!”)
print(V)
Answer:
(ii) 30#40#50#
Maximum value for FROM,TO are 3,4 respectively.
OR
25*50!100!25.

Commonly Made Error:
Students sometimes misunderstand concept of global and local variables.

Answering Tip:
Remember that anything global is available everywhere. And anything that is local is available in a particular area. The same applies to the local and global variables.

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

Question 25.
What is the use of wildcard ?
OR
Consider the structure of table Doctor given below
Doctor_id(p)
Doctor_Name
Hospital_id(F)
Joining_Date
Speciality
Salary
Experience.
Write Python code to create the above table. [2]
Answer:
The wildcard operators are used with the LIKE operator to search a value similar to a specific pattern in a column. There are two wildcard operators.
% – represents 0,1 or many characters — represents a single number or character
OR
import MySQLdb
db = MySQLdb.connect(‘localhost’,’Hos Admin’,1HosAdmin@123′,’XYZHospital’)
cursor=db.cursor()
cursor-execute(“DROP TABLE IF EXISTS DOCTORS”)
sql=”””Create Table Doctor (‘Doctor_ Id’ INT NOTNULL, ‘Doctor_Name1 Char(50) NOTNULL, ‘Hospital_Id’ INT NOTNULL, ‘Joining_Date’ Date NOTNULL, ‘Speciality’ char(50), ‘Salary’ Float, ‘Experience’ Float
PrimaryKey (‘Doctor_Id1 ) )'””’
cursor.execute(sql)
cursor.close()
db. close ()

Section – C

Question 26.
(a) Consider the following tables and give output of the query given below. £1+2]
Table: TRAINS
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 2

Table: PASSENGERS
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 3
SELECT END COUNT(*)FROM
TRAIN GROUP By END HAVING COUNT (*) > 1;

(b) Consider the following tables School and Admin and answer following questions:
Give the output of the following SQL queries:
(i) Select Designation Count (*) From Admin Group By Designation Having Count (*) <2;
(ii) SELECT max (EXPERIENCE) FROM SCHOOL;
(iii) SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY TEACHER;
(iv) SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER;.

Table: School
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 4

TABLE: ADMIN

Code Gender Designation
1001 Male Vice Principal
1009 Female Coordinator
1203 Female Coordinator
1045 Male Hod
1123 Male Senior Teacher
1167 Male Senior Teacher
1215 Male Hod

Answer:
(a)

END COUNT(*)
Habibganj 2
Amritsar juction 2
New Delhi 4

Note: Values may be written in any order
(b) (i)

VICE PRINCIPAL 01

(ii) 16
(iii)

UMESH
YASHRAJ

(iv)

5 MALE
2 FEMALE

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

Question 27.
Write a method/function DISPLAYWORDS() in python to read lines from a text file STORY.TXT, and display those words, which are less than 4 characters. [3]
OR
Write a function CountHisHer() in Python which reads the contents of a text file “Story.txt” and counts the words His and Her (not case sensitive).
Answer:

def DISPLAYWORDS():
C=0
file=open (1 STORY. TXT' , 'r')
1 ine=file . read ()
word = line, split ()
for w in word:
if len(w)<4:
print(w)
file . close ()

OR

def CountHisHer():
for line in open('story.txt'):
# Searching for a word in a file
wordlist=line.strip()
count =0
for w in wordlist:
words = word.split(" ")
for w in words:
# Remove all leading and trailing white spaces
w =w.strip().lower()
if w == 'his' or w=='her':
count = count + 1
if count == 0:
print ("not found in file")
else:
print ("count=",count)

Question 28.
(a) Write SQL queries for (i) to (ii) based on the table EMPLOYEE and DEPARTMENT given below:
Table: EMPLOYEE
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 5

Table- DEPARTMENT

DEPTID DEPTNAME FLOORNO
D001 Personal 4
D002 Admin 10
D003 Production 1
D004 Sales 3

(i) To display the average salary of all employees, department wise.
(ii) To display name and respective department name of each employee whose salary is more than 5000.
(iii) To display the name of employees whose salary not known, in alphabetical order.
(iv) To display DEPTID from the table EMPLOYEE without repetition.
(b) Which clause is used to remove the duplicating rows of the table? [3]
Answer:
(a)(i) SELECT AVG (SALARY)
FROM EMPLOYEE GROUP BY DEPTID;

(ii) SELECT NAME, DEPTNAME FROM EMPLOYEE, DEPARTMENT WHERE EMPLOYEE.DEPTID =DEPARTMENT.
DEPTID AND SALARY>5000;

(iii) SELECT NAME FROM EMPLOYEE WHERE SALARY IS NULL ORDER BY NAME;

(iv) SELECT DISTINCT DEPTID FROM EMPLOYEE;

(b) DISTINCT

Question 29.
Write the definition of a method ZeroEnding (SCORES) to add all those values in the list of SCORES, which are ending with zero (0) and display the sum.
For example:
If the SCORES contain [200,456, 300,100,234,678]
The sum should be displayed as 600 [3]
Answer:

def ZeroEnding(SCORES) :
SZero = 0
for i in SCORES:
if i % 10 == .0:
SZero += i
print ("sum of numbers ending with zero: ", SZero)

Question 30.
Write a function to push any student’s information to stack. [3]
OR
Write a program to input n numbers and to search any number from the list.
Answer:

def push(stack):
s= []
print ("STACK BEFORE PUSH") display(stack)
s.append(input ("Enter student rollno?"))
s.append(raw_input ("Enter student name"))
s.append (raw_input ("Enter student grade"))
stack.append(s)
def display (stack);
l=len (stack)
print ("STACK CONTENTS")
for i in range (1-1,-1,-1):
print stack [i] stack= []
print "Creating stack"
n = input ("Enter the number of students")
for i in range (n) :
push (stack)
display (stack)

OR

n=input("Enter no. of values")
num= []
flag=0
for i in range (n) :
number=input("Enter the number")
num.append(number)
search = input("Enter number to be searched")
for i in range (n) :
if num[i]==search: print (search,"found at position",i)
flag=1
if flag==0:
print (search,"not found in list")

Section – D

Question 31.
Perfect Edu Services Ltd. is an educational organization. It is planning to setup its India campus at Karnataka with its head office at Delhi. The Karnataka Campus has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and MEDIA. A i
You as a network expert have to suggest the best network related solutions for their problems raised in (i) to (v), keeping in mind the distances between the buildings and other given parameters.
Shortest distances between various buildings:

Admin to Engineering 55 mt
Admin to Business 90 mt
Admin to Media 90 mt
Engineering to Business 55 mt
Engineering to Media 90 mt
Business to Media 45 mt
Delhi Head office to Karnataka campus 2175 mt

Number of computers installed at various buildings are as follows:

Admin 110
Engineering 75
Business 40
Media 12
Delhi Head office 20

(i) Suggest the most appropriate location of the server inside the Karnataka campus.
(ii) Draw the cable layout to efficiently connect various buildings within the Karnataka campus for connecting the computers.
(iii) Which hardware device will you suggest to be procured by the company to be installed to protect and control the internet uses within the campus?
(iv) Which of the following will you suggest to establish the online face to face communication between the people in the admin office of Karnataka campus and Delhi Head office.
(v) The organization is planning to link its sale counter situated in various part of the same city. Which type of
network out of LAN, WAN, MAN will be formed? [5]
Answer:
(i) Admin (Due to maximum number of computers)
(ii)
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 6
(iii) Firewall or Router
(iv) Video Conferencing
(v) MAN (Metropolitan Area Network).

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

Question 32.
(a) What does the following code print? [2+3]
for i in range ( 1, 10 ):
for j in range ( 1, 10 ):
print(i * j , )
print()

(b) Consider a table structure as follows:
Employee
Empld
Emp_name
Dept
Age.
Write Python code to create the above table and then create an index as Emp_Id.
OR
(a) Give the output of following with justification.
x = 3
x+= x-x
print(x)

(b) Write Python code to create a table Location with following fields
id → id of the location
bldg_code → code of the building
room → Type of rooms
capacity → capacity of the room
Answer:
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 7

(b)

import MySQLdb
db = MySQLdb.connect('localhostHRM an','HRman@pwd','compvtLtd')
cursor=db.cursor()
cursor.execute("Drop Table IF Exists Employee")
sql="'"'Create Table Employee('Emp_ id' INT NOTNULL, 'Emp_name' char(50)
NOTNULL, 'Dept' char(20)
NOTNULL, 'Age1 INT NOTNULL)"""
cursor.execute(sql)
cursor.execute("""create index eid on user,(Emp_Id)""")
cursor.commit()
cursor.close ()
db. close ()

OR

(a) Output: 3 Working:
x+=x-x will be calculated as x=3+3-3
Hence, final value of x=3

Commonly Made Error
Students sometime get confused in unary and ! binary operators.

Answering Tip
Students should learn the proper working of unary and binary operators properly.

(b)

import MySQLdb
db=MySQLdb.connect ("localhost", "Admin", "Adl23", "HMD")
cursor=db.cursor()
cursor.execute("DROP TABLE IF EXISTS Location")
sql="""Create Table Location (id Numeric (5) PRIMARY KEY, bldg_code varchar(lO) Not Null, room varchar(6) Not Null, capacity Numeric (5) Not Null)"""-
cursor.execute(sql)
db. close ()

Question 33.
Write the full form of CSV.
Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should count and display the occurrence of alphabets A and M (including small cases a and m too). A i
Example:
If the file content is as follows:
Updated information
As simplified by official websites.
The AMCount() function should display the output as:
A or a:4
M or m:2 [5]
OR
Write any two needs for a data file.
A file sports.dat contains information about a formal Event Participant.
Write a function that would read contents from file sports.dat and creates a file named Athletics.dat copying only those records from sports.dat where the event name is “Athletics” A.
Answer:
CSV – Comma Separated Value

PROGRAM

def AMCount:
f = open("story.txt", "r")
A,M = 0, 0
r = f.read()
for x in r:
if x[0] == "A" or x[0] == "a":
A=A+1
elif x[0] == "M" or x[0] == "m":
M=M+1
f.close ()
print("A or a: ", A)
print("M or m: ", M)

OR

Need for a data file:
(i) It is a convenient way to deal with large quantities of data.
(ii) To avoid input of data multiple times during program execution.

PROGRAM

def athletics ( ) :
file1 = open ( "sports . dat" r')
file2 = open ( "Athletics . dat" w')
rec = filel. readlne ()
while rec! = " ":
sport = rec.split('n')
if sport[0] == "Athletics":
file2. write (rec)
file2 .write ( '\n' )
else:
pass
rec = file1. readlne ()
file1. close ()
file2 . close ()
return

Commonly Made Error
Indentation is missing while programming by some students.

Answering Tip
Indentation must be taken care of and should be ’ checked on completion of the code.

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

Section – E

Question 34.
A departmental store MyStore is considering to maintain their inventory using SQL to store the data. As a database administer, Abhay has decided that: [1+1+2]

  • Name of the database – mystore
  • Name of the table – STORE

The attributes of STORE are as follows:
ItemNo- numeric
ItemName – character of size 20
Scode – numeric ,
Quantity – numeric

Table: STORE
CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions 8
(i) Identify the attribute best suitable to be declared as a primary key. [1]
(ii) Write the degree and cardinality of the table STORE. [1]
(iii) Write the commands to
(a) Insert the following data into the attributes Item No, ItemName and SCode respectively in the given table STORE Item No = 2010, ItemName = “Note Book” and Scode = 25
(b) remove the table STORE from the database My Store. [2]
OR (Option for part iii only)
(iv) Write the query to
(a) display the structure of the table STORE, i.e, name of the attributes and their respective data types that he has used in the table.
(b) to display the name of all the items which have quantity less than 100
Answer:
(i) ItemNo
(ii) Degree = 4 Cardinality = 7
(iii) (a) INSERT INTO store (ItemNo, ItemName, Scode) VALUES(2010, “Note Book”,25);
(b) DROP TABLE store;
OR
(iii) (a) Describe Store.
(b) SELECT Itemname FROM store WHERE quantity<100

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

Question 35.
Anubhav has written the following code in Python to create a binary file STUDENT.DAT to add records and to count the number of students who have scored marks above 75. Help him complete the code based on the given requirements. [2]

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
F.close ( )
def GetStudents ( ):
Total = 0
Count-rec = 0
Count-above75 = 0
with open ("STUDENT.DAT", "rb") as F:
while True:
try:
_________ #3 statement to read from the file
Count-rec+=1
Total+=R [2]
if R [2] > 75:
print (R [1], "has percent = ", R [2])
Count-above- 7 5+=1
except:
break
if Count-above-75==0:
print ("There is no student who has percentage more than 75")
average=Total/Count rec
print ("average percent of class = ", average)
AddStudents ( )
GetStudents ( )

(i) which command should be given (marked as # 1 in the Python code) to open the data file. [1]
(ii) Which commands is used to write the list L into the binary file, STUDENT.DAT? (marked as #2 in the Python code) [1]
(iii) Which command is used to read each record from the binary file STUDENT.DAT? (marked as #3 in the Python code). What is the function of seek() method? [2]
Answer:
(i) F= openfSTUDENT.DAT”,’wb’)
(ii) pickle.dump(L,F)
(iii) R = pickle.load(F). seek() moves the current file pointer to a given specified position.