Class - 12 CBSE Computer Science Important File Handling Questions 2025

  • Python File Handling

    Write code to open file contacts.txt with shown information and print it in following form :

    Name: <name>     Phone: <phone number>


  • Python File Handling

    Write a method in Python to read the content from a text file diary.txt line by line and display the same on screen.


  • Python File Handling

    Write a method in Python to write multiple line of text contents into a text file mylife.txt.line.


  • Python File Handling

    Write a program that reads a text file and creates another file that is identical except that every sequence of consecutive blank spaces is replaced by a single space.

    View Answer

    10 Likes


  • Python File Handling

    A file contains a list of telephone numbers in the following form:

    Arvind 7258031 
    Sachin 7259197
    

    The names contain only one word, the names and telephone numbers are separated by white spaces. Write program to read a file and display its contents in two columns.


  • Python File Handling

    Write a program to count the words "to" and "the" present in a text file "Poem.txt".


  • Python File Handling

    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).

    Example :
    If the file content is as follows :
    Updated information
    As simplified by official websites.

    The EUCount() function should display the output as :
    A or a : 4
    M or m : 2


  • Python File Handling

    Write a program to count the number of upper-case alphabets present in a text file "Article.txt".


  • Python File Handling

    Write a method in python to read lines from a text file MYNOTES.TXT, and display those lines, which are starting with an alphabet 'K'.


  • Python File Handling

    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.


Showing 1 - 10 of 59 Questions