Introduction to Problem Solving — NCERT Solutions
CBSE · Class 11 · Computer Science
NCERT Solutions for Introduction to Problem Solving, CBSE Class 11 Computer Science: 18 textbook questions solved step by step.
Interactive on Super Tutor
Studying Introduction to Problem Solving? Get the full interactive chapter.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for NCERT solutions and more.
Free trial, no card needed.
The first 9 solutions are open to read. The other 9 are free with a Super Tutor account.
EXERCISE — Chapter 4: Introduction to Problem Solving
1Write pseudocode that reads two numbers and divide one by another and display the quotient.Show solution
Given: Two numbers are to be read; one is divided by the other and the quotient is displayed.
Concept: Sequential algorithm with input, process, and output steps.
Pseudocode:
BEGIN
READ num1, num2
IF num2 ≠ 0 THEN
quotient ← num1 / num2
PRINT quotient
ELSE
PRINT "Division by zero is not allowed"
END IF
ENDExplanation:
num1andnum2are the two numbers entered by the user.- Before dividing, we check that the divisor (
num2) is not zero to avoid an undefined operation. - The result is stored in
quotientand then printed.
2Two 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 input of 1 means player 1 wins a flip, and a 2 means player 2 wins a flip. Design an algorithm to determine who takes the cake.Show solution
Given: A coin is flipped up to 5 times. Input is 1 (Player 1 wins flip) or 2 (Player 2 wins flip). The first player to win 3 flips takes the cake.
Concept: Iterative algorithm with conditional checks.
Algorithm:
BEGIN
SET count1 ← 0 // wins for Player 1
SET count2 ← 0 // wins for Player 2
SET flip ← 0 // flip counter
WHILE (flip < 5) AND (count1 < 3) AND (count2 < 3) DO
READ result // 1 or 2
IF result = 1 THEN
count1 ← count1 + 1
ELSE IF result = 2 THEN
count2 ← count2 + 1
END IF
flip ← flip + 1
END WHILE
IF count1 = 3 THEN
PRINT "Player 1 wins the cake"
ELSE IF count2 = 3 THEN
PRINT "Player 2 wins the cake"
ELSE
IF count1 > count2 THEN
PRINT "Player 1 wins the cake"
ELSE IF count2 > count1 THEN
PRINT "Player 2 wins the cake"
ELSE
PRINT "It is a tie — flip again"
END IF
END IF
ENDExplanation:
- The loop runs at most 5 times but exits early as soon as either player reaches 3 wins.
- After the loop, the player with 3 wins is declared the winner; if neither reached 3 in 5 flips, the player with more wins takes the cake.
3Write the pseudocode to print all multiples of 5 between 10 and 25 (including both 10 and 25).Show solution
Given: Print all multiples of 5 from 10 to 25 (inclusive).
Concept: Iterative algorithm using a loop that increments by 5.
Pseudocode:
BEGIN
SET num ← 10
WHILE num <= 25 DO
PRINT num
num ← num + 5
END WHILE
ENDOutput: 10, 15, 20, 25
Explanation:
- The variable
numstarts at 10 (the first multiple of 5 in the range). - Each iteration prints the current value and then adds 5.
- The loop stops after printing 25 because the next value (30) exceeds 25.
4Give an example of a loop that is to be executed a certain number of times.Show solution
Concept: A count-controlled loop (also called a definite loop) executes a fixed, predetermined number of times.
Example — Print "Hello" 5 times:
BEGIN
SET count ← 1
WHILE count <= 5 DO
PRINT "Hello"
count ← count + 1
END WHILE
ENDExplanation:
- The variable
countacts as a counter. - The loop body executes exactly 5 times (when count = 1, 2, 3, 4, 5).
- When
countbecomes 6, the conditioncount <= 5is false and the loop terminates. - This is a classic example of a loop executed a certain (fixed) number of times.
5Suppose you are collecting money for something. You need ₹200 in all. You ask your parents, uncles and aunts as well as grandparents. Different people may give either ₹10, ₹20 or even ₹50. You will collect till the total becomes 200. Write the algorithm.Show solution
Given: Collect money from various people (each giving ₹10, ₹20, or ₹50) until the total reaches ₹200.
Concept: Iterative algorithm with an accumulator and a termination condition.
Algorithm:
BEGIN
SET total ← 0
WHILE total < 200 DO
PRINT "Enter amount received (10, 20, or 50): "
READ amount
IF (amount = 10) OR (amount = 20) OR (amount = 50) THEN
total ← total + amount
PRINT "Total collected so far: ", total
ELSE
PRINT "Invalid amount. Please enter 10, 20, or 50."
END IF
END WHILE
PRINT "Target of ₹200 reached! Total collected = ", total
ENDExplanation:
totalaccumulates the money collected.- Each time a valid amount is entered, it is added to
total. - The loop continues until
totalis at least ₹200. - Invalid inputs are rejected with an error message.
6Write 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 5% of tax in the total bill.Show solution
Given: Price and quantity of an item are known. Calculate the total bill and then add 5% GST to get the final bill.
Formula:
Pseudocode:
BEGIN
READ price, quantity
total_bill ← price × quantity
gst_amount ← total_bill × 5 / 100
bill_with_gst ← total_bill + gst_amount
PRINT "Total Bill (before GST) = ", total_bill
PRINT "GST (5%) = ", gst_amount
PRINT "Total Bill (after GST) = ", bill_with_gst
ENDExample: If price = ₹100 and quantity = 3:
- Total Bill =
- GST =
- Bill with GST =
7Write pseudocode that will perform the following:
a) Read the marks of three subjects: Computer Science, Mathematics and Physics, out of 100
b) Calculate the aggregate marks
c) Calculate the percentage of marksShow solution
Given: Marks of three subjects (each out of 100) are read. Aggregate and percentage are to be calculated.
Formula:
Pseudocode:
BEGIN
// Part (a): Read marks
READ cs_marks // Computer Science marks out of 100
READ maths_marks // Mathematics marks out of 100
READ physics_marks // Physics marks out of 100
// Part (b): Calculate aggregate
aggregate ← cs_marks + maths_marks + physics_marks
PRINT "Aggregate Marks = ", aggregate
// Part (c): Calculate percentage
percentage ← (aggregate / 300) × 100
PRINT "Percentage = ", percentage, "%"
ENDExample: CS = 85, Maths = 90, Physics = 78
- Aggregate =
- Percentage =
8Write an algorithm to find the greatest among two different numbers entered by the user.Show solution
Given: Two different numbers are entered by the user. Find the greater one.
Concept: Decision-making (conditional) algorithm.
Algorithm:
BEGIN
READ num1, num2
IF num1 > num2 THEN
PRINT num1, " is the greatest"
ELSE
PRINT num2, " is the greatest"
END IF
ENDExplanation:
- Since the problem states the two numbers are different, we do not need to handle the equal case.
- If
num1is greater thannum2, it is printed as the greatest; otherwisenum2is the greatest.
Example: num1 = 45, num2 = 78 → Output: "78 is the greatest"
9Write 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 the number is between 15 and 25, write the word BLUE. If the number is between 25 and 35, write the word ORANGE. If it is any other number, write that ALL COLOURS ARE BEAUTIFUL.Show solution
Given: A number is entered. Print a colour name based on the range it falls in.
Concept: Multi-way decision (if-else if ladder).
Algorithm:
BEGIN
READ number
IF (number > 5) AND (number < 15) THEN
PRINT "GREEN"
ELSE IF (number > 15) AND (number < 25) THEN
PRINT "BLUE"
ELSE IF (number > 25) AND (number < 35) THEN
PRINT "ORANGE"
ELSE
PRINT "ALL COLOURS ARE BEAUTIFUL"
END IF
ENDNote: The boundary values (5, 15, 25, 35) are not explicitly included in any colour range as the problem says "between". If the boundary values are to be included, replace > with >= and < with <= accordingly.
Example: number = 10 → GREEN; number = 20 → BLUE; number = 30 → ORANGE; number = 50 → ALL COLOURS ARE BEAUTIFUL
Free with a Super Tutor account
- for the first 100 units @ ₹5 per unit
- for next 150 units @ ₹10 per unit
- more than 250 units @ ₹20 per unit
Also add meter charges of ₹75 per month to calculate the total water bill.
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Reach_School_Algorithm:
a) Wake up b) Get ready c) Take lunch box d) Take bus e) Get off the bus f) Reach school or college
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Classify_Numbers_Algo:
INPUT Number
IF Number < 9 → 'Single Digit'
Else If Number < 99 → 'Double Digit'
Else → 'Big'
Verify for (5, 9, 47, 99, 100, 200) and correct the algorithm if required.
Free with a Super Tutor account
Accept_1to100_Algo:
INPUT Number
IF (0 <= Number) AND (Number <= 100) → ACCEPT
Else → REJECT
a) On what values will this algorithm fail?
b) Can you improve the algorithm?
Free with a Super Tutor account
9 more solved questions in Introduction to Problem Solving
They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.
Frequently Asked Questions
What are the important topics in Introduction to Problem Solving for CBSE Class 11 Computer Science?
Are these NCERT Solutions for Introduction to Problem Solving free?
How should I revise Introduction to Problem Solving for Class 11 exams?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Introduction to Problem Solving
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Introduction to Problem Solving chapter — start free.
Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Computer Science. Free to start, no card needed.