When writing calculation instructions in an algorithm (e.g., in pseudocode for a program), they should clearly state both what is to be calculated and how the calculation will be performed.

Computer Science System Analysis and Design Difficulty: Easy
Choose an option
  • A
    Only what is to be calculated
  • B
    Only how to calculate something
  • C
    Both what is to be calculated and how to calculate it
  • D
    Both what is to be calculated and why is it calculated
  • E
    None of the above

Answer

Correct Answer: Both what is to be calculated and how to calculate it

Explanation

Introduction / Context:Algorithms serve as unambiguous blueprints for computation. For developers and reviewers to implement and test reliably, the algorithm must specify the target quantity (what) and the method (how) using precise operations, order of evaluation, and any constraints or edge-case rules. Omitting either dimension leads to misinterpretation.

Given Data / Assumptions:

  • The algorithm is meant to be implemented in code.
  • Calculations may involve formulas, loops, and conditionals.
  • Readers need clarity without guessing intent or method.

Concept / Approach:Good pseudocode (structured English) states the objective and the computation steps. For example: “Compute net_pay = gross_pay - (tax + provident_fund).” This line conveys both what (net_pay) and how (explicit arithmetic). Including only one of these aspects would be insufficient.

Step-by-Step Solution:Identify the requirement of calculation clarity: target + method.Check options for one that includes both elements.Option C matches both what and how; select it.

Verification / Alternative check:Attempting to code from an algorithm that states only the goal (what) forces the programmer to invent a method, risking inconsistency. Conversely, describing only steps (how) without a clear target can misalign outputs. Therefore, both are necessary.

Why Other Options Are Wrong:Options A and B omit essential information. Option D introduces “why,” which is useful contextually but is not required in the calculation instruction itself. Option E is invalid because a correct option exists (C).

Common Pitfalls:Leaving operator precedence or units implicit; always specify order and unit conversions to prevent defects.

Final Answer:Both what is to be calculated and how to calculate it

Discussion & Comments
No comments yet. Be the first to comment!
Join Discussion