2024 08 06 09 59 Solution
2024 08 06 09 59 Solution
2024 08 06 09 59 Solution
Section D
1. Mr. Iqbal is a programmer, who has recently joined the company and given a
task to write a python code to perform the following binary file operations with
the help of two user defined functions/modules:
(a)
2. Mr. Mathew is a programmer, who has recently joined the company and given
a task to write a python code to perform update operation in binary file
(stud.dat) which contain admno (Admission No) and fee(Fee paid by student).
He has succeeded in writing partial code and has missed out certain statements,
You as an expert of Python have to provide the missing statements.
(a)
Page 1
Ans. : (a) import pickle
(b) stud.dat
(c) file.tell()
(d) file.seek(pos)
(e) pickle.dump(st,file)
(f) (iii) pickle.dump(LST,FILE)
3. You are a student in CBSE School. Teacher has given a task to write a python
code to perform the following binary file operations with the help of two user
defined functions/modules:
(a)
Page 2
5. Krishna of class 12 is writing a program to read the details of Sports
performance and store in the csv file “games.csv” delimited with a tab
character. As a programmer, help him to achieve the task.
6. Krishna is confused in Python code given below. Please help him to answer the
following questions.
Page 3
(a) Which line in the above code check for capital letter?
(b) Which line in the above code read the file “story. txt”?
(c) Which line in the above code does not affect the execution of program?
(d) Which line is the above code coverts capital letter to small letter?
(e) Which line is the above code opens the file in write mode?
(f) Which line is the above code saves the data?
(g) Which line(s) is/are the part of selection statement.
(h) Which line(s) is/are used to close story1.txt?
Ans. :
(a) Line 6 (e) Line 2
(b) Line 4 (f) Line 13
(c) Line 10 (g) Line 6, Line 8 and Line 11
(d) Line 7 (h) Line 15
----- -----