Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1OPENFILE "scores.txt" FOR READ | AOpens the file in READ mode so the program can get data out of it | |
| 2OPENFILE "scores.txt" FOR WRITE | BOPENFILE "best.txt" FOR WRITE | |
| 3The program needs to get saved data out of a file, so it chooses READ mode | COpens the file in WRITE mode so the program can put data into it | |
| 4The program needs to save a new high score into a file, so it chooses WRITE mode | DThe file is open in READ mode, but the program tries to write data to it. A file opened FOR READ can only be read. | |
| 5OPENFILE "data.txt" FOR READ WRITEFILE "data.txt", Score | EThe file is open in WRITE mode, but the program tries to read data from it. A file opened FOR WRITE can only be written to. | |
| 6OPENFILE "data.txt" FOR WRITE READFILE "data.txt", Score | FOPENFILE "names.txt" FOR READ |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
file mode — States what a program will do with an open file: READ gets data out of it, WRITE puts data into it. A file is open in only one mode at a time, chosen by what the program needs.OPENFILE "marks.txt" FOR WRITE
WRITEFILE "marks.txt", Score
CLOSEFILE "marks.txt"OPENFILE "names.txt" FOR READ
READFILE "names.txt", Name
CLOSEFILE "names.txt"OPENFILE "log.txt" FOR READ
READFILE "log.txt", Entry
CLOSEFILE "log.txt"OPENFILE "data.txt" FOR READ
READFILE "data.txt", Item
CLOSEFILE "data.txt"// Load the saved score
OPENFILE "best.txt" FOR READ
READFILE "best.txt", HighScore