MCS-201 · Unit 1

Programming Fundamentals

Section 1 of 9

Block 1 · Unit 1Programming Fundamentals10 min · Section 1 of 9

1.1Problem Solving with a Computer

Covers IGNOU MCS-201 §1.2, 1.2.1, 1.2.2

Most failed programs fail before a single line of code is written: the programmer solved the wrong problem, or started typing before understanding it. This section gives you a set of techniques for getting started on any problem, and the standard steps for turning a solution into a working program.

Understand the problem before solving it

The first and most important step is problem definition: working out exactly what must be done, before thinking about how to do it.

A good test: can you state the expected output for one or two sample inputs? If not, the problem is not yet defined.

Techniques for getting started

Even a well-defined problem can feel hard to start. The following techniques are rules of thumb, also called heuristics: methods that often help, but are not guaranteed to work.

TechniqueWhat it meansExample in software
Don’t start with detailsWork out the overall solution first; choose details laterSketch the screens before choosing a library
Use a specific exampleSolve one concrete case by hand, then generaliseWork out 4! by hand before writing a program for n!
Look for similaritiesReuse the approach from a problem you have already solved“Searching invoices is like searching customers”
Work backwardsStart from the goal and ask what is needed just before itTo print a total, you need a sum; for a sum, you need the list of amounts
Reflect afterwardsReview how you solved it, so the method can be reusedNote what worked in a short design document

Using the computer as a problem-solving tool

A computer cannot understand a problem; it can only follow instructions. So the solution has to be developed in stages, from a human-readable plan to a running program. This process is called program development.

1Develop an algorithm and a flowchart
→
2Write the program in a language such as C
→
3Enter the program using an editor
→
4Test and debug the program
→
5Run it with real data and get results
Program development steps

Skipping step 1 is the most common beginner mistake. Fixing a plan on paper takes minutes; fixing the same mistake inside a large program can take hours.

Key takeaways

  • Problem definition comes first: state inputs, outputs and conditions precisely.
  • Heuristics such as specific examples and working backwards help you get started.
  • Program development has five steps, starting with an algorithm and flowchart.
  • Testing on small hand-worked examples catches mistakes early.

Practice questions

Answer on paper first, then check. The explanation matters more than the letter you chose.

Question 1 · multiple choice

What is the main focus of the problem definition phase?

Show answer

Answer: B. Stating precisely what must be done, not how to do it

Problem definition is about what the problem requires (inputs, outputs, conditions). Choosing a language or drawing a flowchart belongs to later stages, after the problem is understood.

Question 2 · multiple choice

A student computes 5! by hand (5 × 4 × 3 × 2 × 1) before writing a general algorithm for n!. Which technique is this?

Show answer

Answer: C. Using a specific example

Solving one concrete case and then generalising is the “specific example” technique. Working backwards would start from the final result and trace back to the inputs.

Question 3 · multiple choice

What does the word “heuristic” mean?

Show answer

Answer: D. A rule of thumb that often helps but is not guaranteed to work

A heuristic is a practical rule of thumb. It is tempting to think of it as a guaranteed method, but that would be an algorithm, not a heuristic.

Question 4 · multiple choice

In the program development steps, what comes immediately after “write the program in a language”?

Show answer

Answer: A. Enter the program using an editor

The order is: algorithm and flowchart, write the program, enter it in an editor, test and debug, then run with real data. Testing comes after the program has been entered.

Question 5 · multiple choice

A programmer must print the total value of all unpaid invoices. They reason: “To print the total I need a sum; to get the sum I need each unpaid amount; to get those I must read every invoice and check its status.” Which technique is this?

Show answer

Answer: B. Working backwards

The reasoning starts at the goal (the total) and moves back step by step to the inputs, which is working backwards. No concrete sample data is used, so it is not the specific-example technique.

Question 6 · short answer

Define the problem “find the highest temperature recorded in a week” by stating its input, output and any condition or edge case.

Show worked answer

Input: the seven daily temperature readings. Output: one value, the highest of the seven readings. Conditions: readings can be negative, so the solution must not assume that 0 is a safe starting value for the highest temperature; a safer start is the first reading. Edge case: if some days have no reading, the problem must say whether to ignore them or report an error. A quick check with sample data, such as 31, 29, 35, 33, 30, 28, 34, gives an expected output of 35.

↑ ↓ move↵ openTab switch type