CBSE · 083Class XII · 2023Section E2 marks
Question 35(2)
30 March 2023 · Computer Science (083)
(iii) (Option only for part (iii))
What should Shreyas fill in :
- Statement 5 to close the binary file named Cust_file.dat ?
- Statement 6 to call the function write_bin() that writes data to the binary file ?
(Refer to the code template given in part (i) of question 35.)
Answer
Statement 5 —
python
bin_file.close()Statement 6 —
python
write_bin()Explanation
Statement 5 releases the file resource, flushing any buffered bytes to disk. Statement 6 actually invokes the function so the file is created and populated.