logo

Question detail

A student opens a text file using Python's w mode. What is the main risk if the file already contains data?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Data structures and abstract data types

Exam-style question

Try this first

A student opens a text file using Python's w mode. What is the main risk if the file already contains data?.

  1. A.The existing contents may be overwritten
  2. B.The file can only be read, not changed
  3. C.The file is automatically converted into a binary file
  4. D.The program can only add data to the end of the file

Model answer

What a good answer should say

  • The existing contents may be overwritten

Explanation

Why this works

Opening a text file in w mode allows writing and normally replaces the existing contents. Append mode, a, is used when new data should be added to the end.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.