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 | |
|---|---|---|
| 1READFILE "Names.txt", LineOfText | ADECLARE LineOfText : STRING | |
| 2OUTPUT LineOfText | BLineOfText is declared as INTEGER but a line of text must be stored in a STRING variable. It should be DECLARE LineOfText : STRING | |
| 3Declare the STRING variable first so it can hold a line of text read from the file | CDisplays the line of text that READFILE has just stored in the variable | |
| 4Each READFILE call reads the next line, so two calls in a row read the first and then the second line | DReads the next line of text from the open file Names.txt and stores it in the variable LineOfText | |
| 5READFILE "Names.txt", "LineOfText" | EREADFILE "Names.txt", LineOfText READFILE "Names.txt", LineOfText | |
| 6DECLARE LineOfText : INTEGER READFILE "Names.txt", LineOfText | FThe variable name is in quotes, so it is a string literal and not a variable. It should be written without quotes: READFILE "Names.txt", LineOfText |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
READFILE "Names.txt", LineOfText — Reads the next line of text from the open file Names.txt into the STRING variable LineOfText. Each READFILE call reads the following line. Declare the variable first.READFILE "Names.txt", LineOfTextDECLARE LineOfText : STRING
READFILE "Names.txt", LineOfTextREADFILE "Names.txt", LineOfText
OUTPUT LineOfTextREADFILE "Names.txt", LineOfText
OUTPUT LineOfTextOPENFILE "Names.txt" FOR READ
READFILE "Names.txt", LineOfText
OUTPUT LineOfText