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 | |
|---|---|---|
| 1CLOSEFILE("Scores.txt") | AFinishes writing and saves the file, so it can be reopened in READ mode to get the data back | |
| 2OPENFILE "Scores.txt" FOR READ | BCLOSEFILE is missing. The file must be closed after writing before it is reopened in READ mode. | |
| 3Data is saved by opening the file for WRITE, writing the item, then closing the file | COPENFILE "Name.txt" FOR WRITE WRITEFILE "Name.txt", Name CLOSEFILE("Name.txt") | |
| 4After reopening the file for READ, READFILE gets back the stored data and OUTPUT shows it was kept | DThe file name in the READ statement is different from the one written, so the saved data is not found. | |
| 5OPENFILE "Data.txt" FOR WRITE WRITEFILE "Data.txt", Score OPENFILE "Data.txt" FOR READ | EOPENFILE "Name.txt" FOR READ READFILE "Name.txt", Saved OUTPUT Saved | |
| 6OPENFILE "Data.txt" FOR WRITE WRITEFILE "Data.txt", Score CLOSEFILE("Data.txt") OPENFILE "Score.txt" FOR READ | FReopens the file that was written earlier, using the same file name, so its data can be read back |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WRITE, CLOSEFILE, READ — Open a file for WRITE, store data with WRITEFILE, then CLOSEFILE. Reopen the same file name for READ and READFILE gets the data back to use again.OPENFILE "score.txt" FOR WRITE
WRITEFILE "score.txt", Points
CLOSEFILE "score.txt"CLOSEFILE "names.txt"
OPENFILE "names.txt" FOR READ
READFILE "names.txt", NameOPENFILE "age.txt" FOR READ
READFILE "age.txt", Age
OUTPUT AgeCLOSEFILE "age.txt"
OPENFILE "age.txt" FOR READ
READFILE "age.txt", AgeOPENFILE "age.txt" FOR READ
READFILE "age.txt", Age
OUTPUT Age