CBSE File-Handling Questions (2019–2024) for Class 12 Computer Science(083)

 

CBSE File-Handling Questions (2019–2024)


  • 2019

    • Count the number of words in a file that start with a vowel.

    • Count the number of uppercase letters in a text file.

  • 2020

    • Open a text file in append mode and write a string into it.

    • Write a program to write a list of strings to a file, one per line.

    • Write a program to remove all lines containing the word "error" from a file.

    • Write a Python function to copy contents of one file to another.

  • 2021

    • Write a function to count the number of lines starting with 'A' in a text file.

    • Read and display student data stored in a binary file.

    • Read a file and display only lines that contain more than 3 words.

    • Read a file and print lines that contain the word "network".

  • 2022

    • Write a function to read a binary file and print all student names having marks > 75.

    • Write a function to search for a name in a text file and return True/False.

  • 2023

    • Define a function to read a CSV file and display rows where marks > 90.

    • Write a program to create a binary file with roll no, name, and marks.

    • Write a function to read a binary file and print records with marks above a threshold.

    • Add a new row to an existing CSV file.

  • 2024

    • Display contents of a CSV file containing book records.

    • Write a function to delete a record from a binary file based on student roll number.



YearQuestion
2019What does seek() do? Give an example.
2020Write a program to count vowels from a file named “poem.txt”.
2021Explain the difference between read() and readline() with examples.
2022Write a program to write and then read data from “student.txt”.


2023

  • readReverse(filename) — Read a text file and display its content in reverse order (character-wise).

  • Significance of newline='' while opening a CSV file.

  • countStudentsFailed(subject_name) — Count students who scored less than 33 in a given subject in a CSV file.

2024

  • countWords(filepath) — Return total number of words in a file.

  • Explain difference between file modes 'w' and 'a'.

  • displayAboveMarks(min_marks) — Read a binary file student.dat and display students with marks above min_marks.


Summary: Consolidated Question Themes by Year

YearKey File-Handling Question Types
2019Count uppercase letters; count words starting with vowels; use of seek()
2020Append strings; write list to file; remove lines with a word; copy file; count vowels
2021Count lines starting with a letter; read/display binary data; read() vs readline(); lines with >3 words; "network" filter
2022Binary file filtering; search name in text; write/read student file
2023CSV filtering and modification; reverse-read file; create binary student data file; marks threshold filtering
2024CSV book records display; delete record by roll number; write vs append mode; count words in file

Comments

Popular Posts