File Processing Set-1

Instruction:-

  • Number of Questions : 25
  • Total Marks : 25
  • Each question carry 1 Marks.
  • No negative marking

  •  

    Results

    #1. Which method is used to read the entire content of a file?

    #2. What does the ‘a’ mode do when opening a file?

    #3. Which of the following opens a file for reading in binary mode?

    #4. What is the use of seek() method?

    #5. Which keyword is used to close a file in Python?

    #6. What happens if you open a non-existent file in read mode?

    #7. Which function returns one line from a file?

    #8. Which mode is used to overwrite the file content?

    #9. What is the default file mode in Python?

    #10. What does the with statement ensure when used with files?

    #11. Which of the following modes is used to open a file for both reading and writing in text mode?

    #12. What does file.tell() return?

    #13. How do you open a file for exclusive creation?

    #14. What happens if you use read() on a closed file?

    #15. Which method is used to write a list of strings to a file?

    #16. The correct way to write “Hello” to a file is:

    #17. What does the flush() method do?

    #18. Which file mode allows reading and writing without truncating the file?

    #19. Which statement best defines the difference between readline() and readlines()?

    #20. Which method checks if the file is closed?

    #21. Which method reads the file line by line using a loop?

    #22. Which file mode creates a new file if it doesn’t exist or truncates it if it does?

    #23. Which file mode is used to append content to an existing file?

    #24. In which mode can we read and append to the same file?

    #25. How do you ensure a file is automatically closed after accessing it?

    Previous
    Finish

    Leave a Comment

    Your email address will not be published. Required fields are marked *