Exam-style question
Try this first
A programmer is developing an application that frequently performs arithmetic operations on positive integers. The programmer initially assigns 8 bits for storing these integers. Explain two different problems that could arise if an overflow condition is not anticipated and handled by the programmer during the execution of this application. [4 marks].
Answer and explanation
Concise answer
1.
Why this is correct
1 mark for identifying 'incorrect calculation results'. 1 mark for explaining how this happens (e.g., due to wrap-around or truncation leading to a wrong value). 1 mark for identifying 'program crashing/unexpected behaviour'. 1 mark for explaining how this happens (e.g., runtime error, exception, or proceeding with corrupted data).
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.
