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 "FileA.txt" FOR WRITE | AThe identifier is not the same in both commands. The first has no .txt extension, so the commands refer to different files. | |
| 2"Scores.txt" | BOPENFILE "Names.txt" FOR WRITE | |
| 3The same file identifier must be used in every file command that works on that file. | CThe file identifier has no double quotes. A file identifier is a STRING, so it must be written as "FileA.txt". | |
| 4A file identifier is a STRING value, so the file name goes inside double quotes and includes the extension .txt. | DOPENFILE "Data.txt" FOR READ READFILE "Data.txt", Line CLOSEFILE "Data.txt" | |
| 5OPENFILE FileA.txt FOR WRITE | EOpens the file named FileA.txt so data can be written to it. The file identifier is a string in double quotes. | |
| 6OPENFILE "Scores" FOR READ CLOSEFILE "Scores.txt" | FA file identifier: the file name written as a STRING value, in double quotes, with its extension. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
"FileA.txt" — A file identifier is the name of the file, written as a string in double quotes with its extension, such as "FileA.txt". The same identifier is used in every file command.OPENFILE "Scores.txt" FOR READ
READFILE "Scores.txt", ScoreOPENFILE "Names.txt" FOR WRITEDECLARE FileName : STRING
FileName ← "Data.txt"
OPENFILE FileName FOR READOPENFILE "Log.txt" FOR WRITE
WRITEFILE "Log.txt", "Done"
CLOSEFILE "Log.txt"FileName ← "Data.txt"
OPENFILE FileName FOR READ
READFILE FileName, Line