Home › Class 12 papers › Computer Science (CS) › Exception & File Handling
Updated 05 October 2026 · Source: CBSE board papers and marking schemes
Free · Class 12 Computer Science (CS) · 46 questions

Exception & File Handling: Class 12 Previous Year Questions

Every CBSE board exam question on Exception & File Handling (Class 12 Computer Science (CS)) from 2023 to 2026, with the years it was asked and the official marking-scheme answer in the free app.

Key facts

Exception & File Handling questions asked in CBSE board exams

Repeated questions first. Open the free app to see each question as it appeared in the paper, with its marking scheme.

  1. State whether the following statement is True or False : 1 In Python, Logical errors can be handled using try……except……finally statement.
    Board 20261 markvery short
  2. "States.csv"   csv                    : 4                            : ['Andhra Pradesh','…
    Board 20264 marksshort answer
  3. Consider the statement given below : 1 f1 = open("pqr.dat","________") Which of the following is the correct file mode to open the file in read only mode ? (A) a (B) rb (C) r+ (D) rb+
    Board 20261 markMCQ
  4. (statements)(options) 332g (output) : N='5' try: print('WORD' + N, end='#') except: print('ERROR',end='#') finally: print('OVER') (A) ERROR# (B) WORD5#OVER (C) WORD5# (D) ERROR#OVER 91 Page 6 of 32 8. Consider the statements given below and then choose the cor…
    Board 20251 markMCQ
  5. PASSENGERS.DAT (records) [PNR· PName· BRDSTN· DESTN· FARE] PNR (string type) PName (string type) BRDSTN (Boarding Station) (string type) DESTN (Destination Station) (string type) FARE (floattpe) f Python f (user defined functions) (i) PASSENGERS.DATMGM1 (ii) (…
    Board 20255 markslong answer
  6. Assertion(A) : For a binary file opened using 'rb' mode, the pickle.dump () method will display an error. Reason (R) : The pickle.dump()method is used to read from a binary file.
    Board 20252 marksAssertion-Reason
  7. Consider the following Python statement : F=OPen('CONTENT.TXT') Which of the following is an invalid statement in Python ? (b) (a) F.seek(1,0) F.seek(0,1) (d) (c) F.seek(0,-1) F.seek(0,2) Q. 17 and 18 are ASSERTION (A) and REASONING (R) based questions. Mark t…
    Board 20241 markAssertion-Reason
  8. State whether the following statement is True or False : While handling exceptions in Python, name of the exception has to be compulsorily added with except clause.
    Board 20241 markvery short
  9. (A) (i) Differentiate between 'w' and 'a' file modes in Python. 2+3=5 (ii) Consider a binary file, items .dat, containing records stored in the given format : {item_id:[item_name,amount]} Write a function, Copy_new(), that copies all records whose amount is gr…
    Board 20245 markslong answer
  10. (A) Write a user defined function in Python named showInLines() which reads contents of a text file named sToRY.TxT and displays every sentence in a separate line. Assume that a sentence ends with a full stop (.), a question mark (?), or an exclamation mark (l…
    Board 20243 marksshort answer
  11. Assertion (A) : CSV file is a human readable text file where each line has a number of fields, separated by comma or some other delimiter. Reason (R) : writerow() method is used to write a single row in a CSV file.
    Board 20241 markAssertion-Reason
  12. Shreyas is a programmer, who has recently been given a task to write a user defined function named write_bin( ) to create a binary file called Cust_file.dat containing customer information - customer number (c_no)·name (c_name), quantity (qty), price (price) a…
    Board 20234 marksshort answer
  13. The syntax of seek( ) is : file object.seek(offset[,reference point]) What is the default value of reference point ? (a) (b) (c) (d)
    Board 20231 markMCQ
  14. Which of the following mode keeps the file offset position at the end of the file ? (a) r+ (b) (c) (d)
    Board 20231 markMCQ
  15. The correct syntax of seek() is: a. file_object.seek(offset [, reference_point]) b. seek(offset [, reference_point]) c. seek(offset, file_object) d. seek.file_object(offset)
    CBSE practice 2023-241 markMCQ
  16. *There is no change in the Question Paper Design and Assessment Pattern for Academic Session 2026-27. pg. 3 ) g Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as: a) Both A and R are True and R is the correct explanation fo…
    Sample paper 2026-271 markAssertion-Reason
  17. Which pickle module method is used to write a Python object to a binary file? a. save() b. serialize() c. store() d. dump()
    CBSE practice 2023-241 markMCQ
  18. Which of the following file opening mode in Python, generates an error if the file does not exist? a. a b. r c. w d. w+
    CBSE practice 2023-241 markMCQ
  19. i. Mention any two differences between seek() and tell(). ii. Consider a file FLIGHT.DAT containing multiple records. The structure of each record is as shown below: [Fno, FName, Fare, Source, Destination] Write a function COPY_REC() in Python that copies all …
    CBSE practice 2023-245 markscase-based
  20. A college administrator, Atul, maintains student course enrollment records. Each record includes Roll_No, Student_Name, Course, Fees. Write Python functions to: I. Input enrollment details and append them to a binary file. II. Update the Fees of all students e…
    Sample paper 2026-275 markslong answer

Practise all 46 Exception & File Handling questions with answers →

Other Class 12 Computer Science (CS) chapters

Frequently asked questions

How many marks does Exception & File Handling carry in the CBSE Class 12 Computer Science (CS) board exam?

Across recent CBSE board papers, Exception & File Handling carried about 7.8 marks per paper on average, making it number 4 of 5 chapters by weightage.

Which years were Exception & File Handling questions asked in CBSE boards?

Questions from Exception & File Handling appeared in the 2023, 2024, 2025, 2026 CBSE Class 12 board exams.

Where can I practise Exception & File Handling previous year questions for free?

On BoardPrep: all 46 Exception & File Handling questions are free to practise online, with official CBSE marking-scheme answers where published.