logo

AQA A-Level Computer Science practice

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 first, then check the answer and practise the same topic again.

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

Answer and explanation

Concise answer

The existing contents may be overwritten

Why this is correct

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.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions