PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
  • Quizzes
  • Code Editor
Home » Python » Quizzes » Python File Handling Quiz

Python File Handling Quiz

Updated on: August 26, 2025 | 2 Comments

This Python file handling quiz provides multiple-choice questions(MCQ) to familiarize with Python file operations. This quiz test your knowledge of file operations such as opening a file, reading a file, writing a file, closing it, renaming a file, deleting a file, and various file methods.

  • Read Python File Handling to solve this quiz.
  • Also see 15 Python Quizzes: each focusing on a specific topic
  • This quiz contains 12 Questions. Solve 8 correct to pass the test.
  • You will have to read all the given answers and click over the correct answer.

1. Select all true statements when a file is opened using the with statement

 
 
 

2. Select the correct output of the following code

fp.seek(5, 1)

 
 
 
 

3. Which method is used to sets the position of a file pointer

 
 
 
 

4. Select the correct method to write a list of lines to a file

 
 
 

5. Select the incorrect file access mode

 
 
 
 

6. If the file is opened in write mode and already exists, it truncates the existing content and places the filehandle at the beginning of the file.

 
 

7. Which method is used to read file line by line

 
 
 
 

8. Select all correct methods to delete files in Python

 
 
 
 

9. Select all correct methods to copy the source file’s content to the destination file

 
 
 
 

10. Select the correct mode to open a file for appending as well as reading

 
 
 
 

11. Select the correct access mode to open a file only for exclusive creation

 
 
 
 

12. Select the correct method to get the list of files from a directory

 
 

Loading ... Loading …

Loading

Filed Under: Python, Python File Handling, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Image

I’m Vishal Hule, the Founder of PYnative.com. As a Python developer, I enjoy assisting students, developers, and learners. Follow me on Twitter.

Related Tutorial Topics:

Python Python File Handling Python Quizzes

All Coding Exercises:

C Exercises
C++ Exercises
Python Exercises

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 25+ questions
  • Each Quiz contains 25 MCQ
Exercises
Quizzes

Loading comments... Please wait.

In: Python Python File Handling Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • 15 Python Quizzes
  • Python Online MCQ Test
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Multithreading and Multiprocessing Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

 Explore Python

  • Python Tutorials
  • Python Exercises
  • Python Quizzes
  • Python Interview Q&A
  • Python Programs

All Python Topics

Python Basics Python Exercises Python Quizzes Python Interview Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2025 pynative.com

Advertisement