9618/32 May/June 2022 · Question 4(a) · 2 marks
The assignment statements X1 = Y2 – 12 and Z = Y12 + Z1 are invalid. State the reason in each case.
Points that gain marks
- X1 = Y2 – 12: an unsigned integer, 12, is used instead of the last variable.
- Z = Y12 + Z1: the variable Z is not valid: there is no unsigned integer after the Z.
In this lab: Level 1 has both strings, and shows the parse tree of every valid one.