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 | |
|---|---|---|
| 1DECLARE Age : INTEGER Age ← "twelve" | AAn error if Total was never declared: the variable is used without a DECLARE statement | |
| 2Total ← Total + 5 | BDECLARE Name : STRING Name ← "Ava" | |
| 3An array index outside the bounds is a data type error because that element does not exist | CA data type error: a STRING value is assigned to a variable declared as INTEGER | |
| 4A variable must be declared with a data type before a value is stored in it | DPrice is used without DECLARE. Fix: add DECLARE Price : REAL before assigning the value. | |
| 5DECLARE Count : INTEGER Count ← "ten" | EDECLARE Scores : ARRAY[1:5] OF INTEGER Scores[6] ← 10 | |
| 6Price ← 4.50 OUTPUT Price | FA STRING is assigned to an INTEGER variable. Fix: store a whole number such as Count ← 10, or declare Count as STRING. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Data type error — An error caused by using a value its data type does not allow (e.g. a STRING stored in an INTEGER, or an index outside the array) or by using a variable that was never DECLAREd.DECLARE Score : INTEGER
Score ← 10DECLARE Name : STRING
Name ← "Ava"DECLARE Marks : ARRAY[1:5] OF INTEGER
Marks[5] ← 90DECLARE Price : REAL
Price ← 4.5DECLARE Total : INTEGER
Total ← 0
OUTPUT Total