Read 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 must data be read into memory before a program can use it?
Why must data be read into memory before a program can use it?
Programs can only work with data in RAM
What does CSV stand for in file formats?
What does CSV stand for in file formats?
Comma Separated Values
In a CSV file, how are different fields within a record separated?
In a CSV file, how are different fields within a record separated?
By commas
What are carriage return and line feed characters used for in text files?
What are carriage return and line feed characters used for in text files?
Tell computer where lines end & begin
What does the strip() function do when reading file data?
What does the strip() function do when reading file data?
Removes invisible end-of-line chars
What does 'r' mean in the code: file = open('Prizes.txt', 'r')?
What does 'r' mean in the code: file = open('Prizes.txt', 'r')?
Read mode (read-only)
What does line.split(',') do to the string 'Bear,123,4.5'?
What does line.split(',') do to the string 'Bear,123,4.5'?
Creates ['Bear', '123', '4.5']
When you read data from a text file, what data type is it initially?
When you read data from a text file, what data type is it initially?
String (even numbers)
What must you do with '4.25' read from a file before using it in price calculations?
What must you do with '4.25' read from a file before using it in price calculations?
Convert it to float
What does prizeTable.append(prize) create when used repeatedly?
What does prizeTable.append(prize) create when used repeatedly?
A two-dimensional list (list of lists)
Why must you use file.close() after reading a file?
Why must you use file.close() after reading a file?
To free up system resources
What file mode mistake would overwrite your file instead of reading it?
What file mode mistake would overwrite your file instead of reading it?
Using 'w' instead of 'r'
