KnowledgeBoat Logo

Class - 12 CBSE Computer Science Important File Handling Questions 2025

  • Python File Handling

    Write a program that reads characters from the keyboard one by one. All lower case characters get stored inside the file LOWER, all upper case characters get stored inside the file UPPER and all other characters get stored inside file OTHERS.


  • Python File Handling

    Write a function in Python to count and display the number of lines starting with alphabet 'A' present in a text file "LINES.TXT". e.g., the file "LINES.TXT" contains the following lines:

    A boy is playing there.
    There is a playground.
    An aeroplane is in the sky.
    Alphabets & numbers are allowed in password.
    

    the function should display the output as 3.


  • Python File Handling

    Write a program that counts the number of characters up to the first $ in a text file.


  • Python File Handling

    Write a program that will create an object called filout for writing, associate it with the filename STRS.txt. The code should keep on writing strings to it as long as the user wants.


  • Python File Handling

    Write a function Show_words() in python to read the content of a text file 'NOTES.TXT' and display only such lines of the file which have exactly 5 words in them.

    Example, if the file contains :

    This is a sample file.
    The file contains many sentences.
    But need only sentences which have only 5 words.

    Then the function should display the output as :

    This is a sample file.
    The file contains many sentences.


  • Python Data Handling

    Write a code snippet that will create an object called fileout for writing; associate it with the filename 'STRS'. The code should keep on writing strings to it as long as the user wants.


  • Python Data Handling

    Write a program to count the number of uppercase alphabets present in a text file "Poem.txt".


  • Python Data Handling

    Write a program to search the names and addresses of persons having age more than 30 in the data list of persons stored in a text file.


  • Python Data Handling

    Write a function in Python to count and display the number of lines starting with alphabet 'A' present in a text file "LINES.TXT", e.g., the file "LINES.TXT" contains the following lines:

    A boy is playing there. 
    There is a playground.
    An aeroplane is in the sky.
    A cricket match is being played.
    

    The function should display the output as 3.


  • Python File Handling

    Write a program to accept string/sentences from the user till the user enters “END” to. Save the data in a text file and then display only those sentences which begin with an uppercase alphabet.


Showing 11 - 20 of 59 Questions