Python Data File Handling

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By MariamaThomas201
M
MariamaThomas201
Community Contributor
Quizzes Created: 1 | Total Attempts: 193
| Attempts: 193 | Questions: 12
Please wait...
Question 1 / 12
0 %
0/100
Score 0/100
1. Which file content is human readable format ?

Explanation

A text file is considered to be in human-readable format because it contains plain text that can be easily understood and interpreted by humans. Unlike a binary file, which contains data in a format that is not easily readable by humans, a text file can be opened and read using a simple text editor or word processor. The content of a text file is typically organized in lines and can include characters, numbers, symbols, and other readable text.

Submit
Please wait...
About This Quiz
Python Data File Handling - Quiz

This quiz on Python Data File Handling assesses knowledge on file types, modes, operations, and handling techniques in Python. It covers text and binary file handling, file modes, and essential Python modules, enhancing practical file manipulation skills.

Tell us your name to personalize your report, certificate & get on the leaderboard!
2. The  readlines() method return -----------------

Explanation

The readlines() method in Python returns a list of lines from a file. Each line is represented as a string element in the list. Therefore, the correct answer is "List of Lines".

Submit
3. In which mode  all the files are opened in by default.

Explanation

By default, when files are opened, they are opened in read mode. This means that the file can only be read and its contents can be accessed, but no modifications can be made to the file. In read mode, the file pointer is positioned at the beginning of the file, allowing the user to read the file from the start.

Submit
4. Opening a file in append mode erases the previous data

Explanation

Opening a file in append mode does not erase the previous data. Instead, it allows new data to be added to the end of the file without overwriting or deleting the existing content. This is useful when we want to add new information to a file without losing the existing data.

Submit
5. Given the following code …. File=open("Mydata","a") File.close()                              What type of file is mydata?

Explanation

The file "Mydata" is a text file because it is opened with the mode "a" which stands for append. This mode is typically used for writing text to a file.

Submit
6. From the following which file  mode is used to read from a binary file.

Explanation

The correct answer is "rb". In file modes, "r" is used to read from a file, but when dealing with binary files, the "b" is added to specify that the file is in binary format. This mode allows for reading binary data from the file.

Submit
7. When you open a  file  in a+ mode file pointer will be at

Explanation

When you open a file in a+ mode, the file pointer will be at the end of the file. This means that any data written to the file will be appended to the existing content. If there is no existing content in the file, the file pointer will still be at the end of the file, ready for data to be written.

Submit
8. Name the method used to know the current position of the file pointer

Explanation

The method used to know the current position of the file pointer is "tell()". This method returns the current position of the file pointer, which indicates the next byte that will be read or written. By using this method, we can keep track of the current position within a file and perform operations accordingly.

Submit
9. Name the module should be imported to  operate with binary file .

Explanation

The correct answer is pickle. The pickle module in Python provides functions for serializing and deserializing objects. It is used to convert complex objects into a byte stream, which can be stored or transmitted, and then convert it back into the original object. This module is commonly used for working with binary files, as it allows for easy storage and retrieval of data in a compact format.

Submit
10. Read the following code : F1=open("main.txt","w") F1.write("BYE") print(F1.tell()) if the file contains  "GOOD"  before execution . What will be display after the execution of the above code:

Explanation

The code opens a file named "main.txt" in write mode and assigns it to the variable F1. It then writes the string "BYE" to the file. The print(F1.tell()) statement returns the current position of the file pointer, which is the number of characters written to the file so far. Since "BYE" has 3 characters, the file pointer is at position 3. Therefore, the answer is 7.

Submit
11. Which module is required to use built in function dump()?

Explanation

The module required to use the built-in function dump() is pickle. The dump() function is used to serialize and save Python objects into a file. The pickle module provides the necessary functionality to perform this serialization process.

Submit
12. Current working directory / folder  can be determined by using ------------------ method .

Explanation

The correct answer is "getcwd()". This method is used to determine the current working directory or folder.

Submit
View My Results

Quiz Review Timeline (Updated): Jul 16, 2025 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 16, 2025
    Quiz Edited by
    ProProfs Editorial Team
  • May 12, 2020
    Quiz Created by
    MariamaThomas201
Cancel
  • All
    All (12)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which file content is human readable format ?
The  readlines() method return -----------------
In which mode  all the files are opened in by default.
Opening a file in append mode erases the previous data
Given the following code …. ...
From the following which file  mode is used to read from a binary...
When you open a  file  in a+ mode file pointer will be at
Name the method used to know the current position of the file pointer
Name the module should be imported to  operate with binary file .
Read the following code : ...
Which module is required to use built in function dump()?
Current working directory / folder  can be determined by using...
Alert!

Advertisement