Skip to content
← Computer Science

Computer Science · Class 11 Optional

Ch 4Introduction to Problem Solving — Class 11 Computer Science, concept-first.

Computers surround us today because they let us finish routine tasks faster and with fewer errors. A familiar illustration is booking a train ticket online. India runs one of the world's largest railway networks, which makes reservation an inherently complicated job: the system must track details of every train (its ty…

36

Q&A

21

Concepts

~8m

Unit weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

Squaring A Number

Think of a square tile on a floor. If the tile has a side of length 2 units, how many small unit squares fit inside it? You'd count 2 rows of 2 squares each — that's squares.

Start with this concept →

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

4.1

Introduction

Computers surround us today because they let us finish routine tasks faster and with fewer errors. A familiar illustration is booking a train ticket online.

4.2

Steps for Problem Solving

Solving a problem rarely happens in one leap; it usually unfolds as a series of steps. A real-life analogy makes this clear. Imagine that a vehicle you are driving begins to make an odd noise.

4.2.1

Analysing the problem

The first step of problem solving is to understand the problem thoroughly before attempting any solution.

4.2.2

Developing an Algorithm

Before a single line of program code is written, a solution to the problem must be devised. That solution, expressed in natural language as a set of steps, is called an algorithm.

4.2.3

Coding

Once the algorithm is finalised, it must be converted into a form the computer can act upon — that conversion is coding.

4.2.4

Testing and Debugging

Writing the program is not the end of the journey — the program must now be tested against various parameters to confirm it truly solves the problem. A program passes muster only when it:

4.3

Algorithm

Everyday life is full of activities we complete by following a fixed sequence of steps — getting ready for school, making breakfast, riding a bicycle, wearing a tie, solving a puzzle.

4.3.1

Why do we need an Algorithm?

A programmer writes a program to make the computer perform certain tasks, and the computer then follows the steps written in that program code.

4.4

Representation of Algorithms

Software designers and programmers use their algorithmic thinking skills to analyse a problem and identify the logical steps that must be followed to reach a solution.

4.4.1

Flowchart — Visual Representation of Algorithms

4 Q

A flowchart is a visual representation of an algorithm: a diagram made up of boxes, diamonds and other shapes connected by arrows.

4.4.2

Pseudocode

3 Q

A pseudocode (pronounced Soo-doh-kohd) is the second common way of representing an algorithm. It is a non-formal language that helps programmers write algorithms: a detailed description of the instruc…

4.5

Flow of Control

The flow of control is the order in which the events of an algorithm unfold — exactly what a flowchart's arrows depict.

4.5.1

Sequence

Look back at Examples 4.3 (sum of two numbers) and 4.4 (area and perimeter of a rectangle): in both, the statements execute one after another, from the first line to the last, with nothing skipped and…

4.5.2

Selection

4 Q

Decision-making enters an algorithm the moment more than one path is possible. Selection is the flow-of-control construct that chooses among alternatives based on a condition.

4.5.3

Repetition

4 Q

When giving directions, we naturally speak in repetitions: "walk 50 steps then turn right", or "walk till the next crossing, then take a right turn". Other everyday examples of the same pattern:

4.6

Verifying Algorithms

2 Q

Imagine a banking software that does not work correctly — say the online money-transfer module is programmed wrongly and credits only half the transacted amount into the account, or worse, debits the…

4.7

Comparison of Algorithm

A problem solvable by computer can usually be approached in more than one way — which means more than one algorithm can exist for it.

4.8

Coding

Once an algorithm is finalised, it must be coded in a high-level programming language of the programmer's choosing: the ordered set of instructions is written in that language, following its syntax.

4.9

Decomposition

Some problems are complex in the sense that their solution is not directly derivable — no single algorithm obviously produces it.

Summary

- Problem solving is the process of identifying a problem, developing an algorithm for it, and implementing that algorithm as a computer program.

More questions

+Show 18 questions18 questions
  1. Q1Write pseudocode that reads two numbers and divide one by another and display the quotient.Free
  2. Q2Two friends decide who gets the last slice of a cake by flipping a coin five times. The first person to win three flips wins the cake. An in…Free
  3. Q3Write the pseudocode to print all multiples of 5 between 10 and 25 (including both 10 and 25).Free
  4. Q4Give an example of a loop that is to be executed a certain number of times.Preview
  5. Q5Suppose you are collecting money for something. You need ₹ 200 in all. You ask your parents, uncles and aunts as well as grandparents. Diffe…Preview
  6. Q6Write the pseudocode to print the bill depending upon the price and quantity of an item. Also print Bill GST, which is the bill after adding…Preview
  7. Q7Write pseudocode that will perform the following: a) Read the marks of three subjects: Computer Science, Mathematics and Physics, out of 100…Preview
  8. Q8Write an algorithm to find the greatest among two different numbers entered by the user.Preview
  9. Q9Write an algorithm that performs the following: Ask a user to enter a number. If the number is between 5 and 15, write the word GREEN. If th…Preview
  10. Q10Write an algorithm that accepts four numbers as input and find the largest and smallest of them.Preview
  11. Q11Write an algorithm to display the total water bill charges of the month depending upon the number of units consumed by the customer as per t…Preview
  12. Q12What are conditionals? When they are required in a program?Preview
  13. Q13Match the pairs Flowchart Symbol (as printed, top to bottom): 1. a rounded rectangle (terminator/stadium shape) · 2. a parallelogram · 3. a…Preview
  14. Q14Following is an algorithm for going to school or college. Can you suggest improvements in this to include other options? Reach_School_Algori…Preview
  15. Q15Write a pseudocode to calculate the factorial of a number (Hint: Factorial of 5, written as 5! = 5×4×3×2×1).Preview
  16. Q16Draw a flowchart to check whether a given number is an Armstrong number. An Armstrong number of three digits is an integer such that the sum…Preview
  17. Q17Following is an algorithm to classify numbers as “Single Digit”, “Double Digit” or “Big”. Classify_Numbers_Algo INPUT Number IF Number < 9 "…Preview
  18. Q18For some calculations, we want an algorithm that accepts only positive integers upto 100. Accept_1to100_Algo INPUT Number IF (0<= Number) AN…Preview