A program can follow its instructions perfectly and still be wrong, if the instructions solve a different problem from the one that was asked. Problem analysis is the work done before planning a solution, to make sure the right problem is being solved.

Understanding the Request

Problem analysis means studying the task until four things are known: the inputs, the required outputs, the rules that connect them, and the limits on valid values.

Definition: Requirement. A condition that a solution must satisfy in order to be accepted as solving the problem.

Unclear words must be resolved. "Calculate the result of a student" could mean a total, a percentage, a grade or a pass decision. Where possible, the person who set the task should be asked. Where that is not possible, the assumption used should be written down so that others can see it.

Questions to Ask During Analysis

Table 1.4 lists the questions that a careful analysis answers, with a billing task as the illustration.

Table 1.4: Analysis questions applied to a billing task

Question Answer for the billing task
What is given? Price and quantity of each item
What is required? The final amount to be paid
What rules apply? Amount = sum of price × quantity, plus tax
What limits apply? Prices and quantities cannot be negative
What is unclear? The tax rate and how to round the amount

Comparing Possible Approaches

A solution approach is a way of reaching the required result. Most problems can be solved in more than one way. To find a name in a list, one could examine every name in turn. If the list is in alphabetical order, one could instead open it near the middle and discard half the list at each step.

Approaches are compared on three points:

  • Completeness: does the approach handle every valid input, including boundary cases?
  • Termination: does it always finish?
  • Resource use: does it need a reasonable amount of time and memory?

An approach should not be chosen only because it is familiar. A method that checks every item is acceptable for ten values but may be unsuitable for ten million.

Example 1.4: Analysing a requirement

Problem: A shop asks for "a program to work out the bill". Analyse the requirement.

Solution:

  1. Inputs: for each item, its price and the quantity bought.
  2. Output: the amount the customer must pay.
  3. Rule: multiply each price by its quantity, add the results, then add tax.
  4. Unclear points: the tax rate, and whether any discount applies.
  5. Assumption stated: tax is 5 per cent and there is no discount.
  6. Instance: 2 pens at 10 rupees and 1 book at 80 rupees. The subtotal is 2 × 10 + 80 = 100 rupees, and tax is 5 rupees.

Result: Under the stated assumption, the bill for this instance is 105 rupees.

Common mistakes

  • Beginning to write code while the meaning of the task is still unclear.
  • Making an assumption silently instead of writing it down.
  • Choosing the first approach that comes to mind without checking whether it handles all valid inputs.

Key takeaways

  • Analysis identifies inputs, outputs, rules and limits before any solution is planned.
  • Unclear requirements are resolved by asking or by stating an assumption.
  • Most problems have several possible approaches.
  • Approaches are compared for completeness, termination and resource use.

Practice questions

  1. List the four things that problem analysis must identify.
  2. What should be done when a requirement is unclear and no one can be asked?
  3. Give one reason a familiar approach may be unsuitable.

Answers to the practice questions

  1. The inputs, the required outputs, the rules connecting them, and the limits on valid values.
  2. Choose a reasonable interpretation and state the assumption in writing.
  3. It may need too much time or memory for large inputs, or may not handle every valid input.

Sources

  • Official BCA syllabus (NEP 2025 scheme), Problem Solving Techniques, course code 25BCA401SEC01, Unit I