KnowledgeBoat Logo

Class - 12 CBSE Computer Science Important File Handling Questions 2025

  • Python File Handling

    Write a command(s) to write the following lines to the text file named hello.txt. Assume that the file is opened in append mode.

    “ Welcome my class”
    “It is a fun place”
    “You will learn and play”
    


  • Python File Handling

    Write a program to enter the following records in a binary file :

    Item No — integer
    Item_Name — string
    Qty — integer
    Price — float

    Number of records to be entered should be accepted from the user. Read the file to display the records in the following format:

    Item No :
    Item Name :
    Quantity :
    Price per item :
    Amount : ( to be calculated as Price * Qty)


  • Python File Handling

    Write a function in Python to read a text file, Alpha.txt and displays those lines which begin with the word ‘You’.


  • Python File Handling

    Write a function, vowelCount() in Python that counts and displays the number of vowels in the text file named Poem.txt.


  • Python File Handling

    Write a Python function that displays all the words containing @cmail from a text file "Emails.txt".


  • Python File Handling

    Write a Python function that finds and displays all the words longer than 5 characters from a text file "Words.txt".


  • Python File Handling

    A file sports.dat contains information in following format:
    Event - Participant
    Write a function that would read contents from file sports.dat and creates a file named Atheletic.dat copying only those records from sports.dat where the event name is "Atheletics".


  • Python File Handling

    Consider the following definition of a dictionary Member, write a method in Python to write the content in a pickled file member.dat.

    Member = {'MemberNo.': ..............., 'Name': ...............}
    


  • Python File Handling

    Consider the following definition of dictionary Staff, write a method in python to search and display content in a pickled file staff.dat, where Staffcode key of the dictionary is matching with 'S0105'.

    Staff = {'Staffcode': ..............., 'Name' = ...............} 
    


  • Python File Handling

    Considering the following definition of dictionary COMPANY, write a method in Python to search and display the content in a pickled file COMPANY.DAT, where CompID key of the dictionary is matching with the value '1005'.

    Company = {'CompID' = ........., 'CName' = ........., 'Turnover' = .........}
    


Showing 31 - 40 of 59 Questions