Write files (Edexcel GCSE Computer Science): Quizzes
📚Quizzes
Practise the questions
12 questions from this quiz
ShowHide
Practise the questions
12 questions from this quiz
Why do we need to write data to files?
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?
What happens to data stored in RAM when a program finishes running?
It disappears forever
In a text file structure, what is a record?
In a text file structure, what is a record?
Info about one item
What character separates fields within each record in a text file?
What character separates fields within each record in a text file?
Comma
What is the line feed character written as in code?
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?
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?
What does 'w' mean when opening a file in Python?
Write mode
What happens if you open an existing file in 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?
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?
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?
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?
Which method is used to actually save a line of text to a file?
file.write()
