Write files (Edexcel GCSE Computer Science): Quizzes

📚Quizzes
Writing files
Sign up to keep practising.Create a free account to play more quizzes and track your progress.

Practise the questions

12 questions from this quiz

Show

Why do we need to write data to files?

To save data after program ends

What happens to data stored in RAM when a program finishes running?

It disappears forever

In a text file structure, what is a record?

Info about one item

What character separates fields within each record in a text file?

Comma

What is the line feed character written as in code?

\n

What happens if you forget to add the line feed character when writing to a file?

All text appears on one long line

What does 'w' mean when opening a file in Python?

Write mode

What happens if you open an existing file in write mode?

It deletes all existing content

Which step comes immediately after opening a file in write mode?

Loop through data structure

What is the purpose of the str() function when writing to files?

To convert numbers to strings

Why must you close a file after writing to it?

To ensure data is saved & free resources

Which method is used to actually save a line of text to a file?

file.write()

Join 100,000+ GCSE students studying Quizzes with us.

Select your subjects, and get access to A+ resources today.