PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python File Handling Quiz

Python File Handling Quiz

Updated on: August 24, 2022 | 1 Comment

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.

  • 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 incorrect file access mode

 
 
 
 

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

 
 

4. Select all correct methods to delete files in Python

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

8. Select the correct output of the following code

fp.seek(5, 1)

 
 
 
 

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

 
 
 
 

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

 
 

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

 
 
 

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

 
 
 
 

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

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python File Handling Python Quizzes

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 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python File Handling Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

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

All Python Topics

Python Basics Python Exercises Python Quizzes 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.

Explore Python

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

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

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, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com