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 | |
|---|---|---|
| 1WRITEFILE "Names.txt", LineOfText | AWRITEFILE "Names.txt", LineOfText WRITEFILE "Names.txt", LineOfText | |
| 2LineOfText ← "Amira Khan" | BThe arguments are in the wrong order. The file name must come first, then the variable holding the line of text. | |
| 3Each WRITEFILE adds one more line to the file, so two WRITEFILE statements put two lines in it | CThe comma between the file name and the variable is missing. | |
| 4The line of text can come from the user: read it with INPUT into a STRING variable, then write it | DStores a line of text in a STRING variable so it is ready to be written to the file | |
| 5WRITEFILE LineOfText, "Names.txt" | EINPUT LineOfText WRITEFILE "Names.txt", LineOfText | |
| 6WRITEFILE "Names.txt" LineOfText | FWrites the text held in the STRING variable LineOfText into Names.txt as one new line |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WRITEFILE "Names.txt", LineOfText — Writes the text held in the STRING variable LineOfText into the file Names.txt as one new line. Each WRITEFILE adds one more line to the file.OPENFILE "Names.txt" FOR WRITE
LineOfText ← "Ava Nguyen"
WRITEFILE "Names.txt", LineOfTextLineOfText ← "Mia Smith"
WRITEFILE "Names.txt", LineOfTextOPENFILE "Names.txt" FOR WRITE
LineOfText ← "Leo Jones"
WRITEFILE "Names.txt", LineOfTextOPENFILE "Names.txt" FOR WRITE
INPUT LineOfText
WRITEFILE "Names.txt", LineOfTextDECLARE LineOfText : STRING
LineOfText ← "Zoe Brown"
WRITEFILE "Names.txt", LineOfText