1Medium
0/1

A software engineer is developing a robust payment processing system. During test execution, two distinct bugs are identified:

  1. A division-by-zero crash occurs when the number of split-bill participants is entered as 0. The program terminates abruptly.
  2. A tax calculation bug where the system uses tax_rate×0.1\text{tax\_rate} \times 0.1tax_rate×0.1 instead of tax_rate×0.01\text{tax\_rate} \times 0.01tax_rate×0.01, resulting in incorrect invoice amounts, though the program runs to completion without any warnings.

Which statement correctly classifies these bugs and describes how they interact with translation (compilation/interpretation) and defensive programming?

Bug 1 is a runtime error and Bug 2 is a logic error. A standard compiler or interpreter cannot detect either of these bugs during translation; instead, input validation and defensive programming are required to prevent Bug 1.

Bug 1 is a syntax error and Bug 2 is a logic error. The compiler's syntax analyzer will fail to translate the program if a division by zero is mathematically possible, whereas Bug 2 can only be caught using exception handling blocks.

Bug 1 is a runtime error and Bug 2 is a syntax error. Bug 2 will prevent successful compilation because the tax rate multiplier violates the language rules, whereas Bug 1 requires a dry run with trace tables to identify.

Bug 1 is a logic error and Bug 2 is a runtime error. Both errors will cause the interpreter to halt execution immediately, and both can be successfully prevented by incorporating strict type checking at the compilation stage.

Robust and secure programming Questions

Practise AQA GCSE Computer Science Robust and secure programming with exam-style questions for GCSE Computer Science. 28 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

Next

Robust and secure programming Questions

  1. GCSE
  2. /Computer Science
  3. /Robust and secure programming