Exam-style question
Try this first
A program receives the text '42'. Explain why it should be treated as two character codes if the input is text, and contrast this with storing the numerical value 42 in pure binary.
Answer and explanation
Concise answer
The text '42' contains two characters: '4' followed by '2'.
Why this is correct
The number of characters and the numerical value are separate ideas. Text input preserves the individual digit characters, whereas a numerical value represents the quantity 42. A program may need to convert between these forms before carrying out arithmetic.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
