# Introduction to Problem Solving Class 11 Questions and Answers

Teachers and Examiners (CBSESkillEduction) collaborated to create the Introduction to Problem Solving Class 11 Questions and Answers. All the important Information are taken from the NCERT Textbook Computer Science (083) class 11.

Contents

## Introduction to Problem Solving Class 11 Questions and Answers

1. Write pseudocode that reads two numbers and divide one by another and display the quotient.
Input num1
Input num2
Calculate div = num1 / num2
Print div

2. Two 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?
Set p1 = 0
Set p2 = 0
For i in range (5):
Input coin
If coin = 1 then
P1 += 1
Elif coin = then
P2 += 1
If p1 > 2 then
P1 wins
Elif p2 > 2 then
P2 wins

3. Write the pseudocode to print all multiples of 5 between 10 and 25 (including both 10 and 25).
FOR num := 10 to 25 DO
IF num % 5 = 0 THEN
PRINT num
END IF
END LOOP

4. Give an example of a loop that is to be executed a certain number of times.
SET i: = 1
FOR i: = 1 to 10 do
PRINT i
END LOOP

5. Suppose 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.
Step 1 : Start
Step 2 : Set money := 0
Step 3 : While Loop (money <200)
Input money
Step 4 : money = money + money
Step 5 : End Loop
Step 6 : Stop

6. Write 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.
INPUT Item
INPUT price
CALCULATE bill := Item * price
PRINT bill
CALCULATE tax := bill * (5 / 100)
CALCULATE GST_Bill := bill + tax
PRINT GST_Bill

7. Write 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 marks
INPUT computer, maths, phy
COMPUTE average := (computer + maths + phy) / 3
COMPUTE percentage := (average / 300) * 100
PRINT average
PRINT percentage

8. Write an algorithm to find the greatest among two different numbers entered by the user.
INPUT num1, num2
IF num1 > num2 THEN
PRINT num1
ELSE IF num2 > num1 THEN
PRINT num2
END IF

9. Write 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.
INPUT num
IF num >=5 AND num < 15 THEN
PRINT ‘GREEN’
ELSE IF num >= 15 AND num < 25 THEN
PRINT ‘BLUE’
ELSE IF num >= 25 AND num < 35 THEN
PRINT ‘ORANGE’
ELSE
PRINT ‘ALL COLOURS ARE BEAUTIFUL’
END IF

10. Write an algorithm that accepts four numbers as input and find the largest and smallest of them.
INPUT max
SET min := max
FOR i: = 1 to 3 do
INPUT num
IF num<max THEN
SET max :=num
ELSE
SET min := num
END LOOP
PRINT max
PINT min

11. Write an algorithm to display the total water bill charges of the month depending upon the number of units consumed by the customer as per the following criteria:
• 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 .
INPUT units
SET bill := 0
IF units > 250 THEN
CALCULATE bill := units * 20
ELIF units <= 100 THEN
CALCULATE bill := units * 5
ELSE
CALCULATE bill := 100 * 5 + (units – 100) * 10
END IF
END IF
CALCULATE totalBill := bill + 75
PRINT totalBill

12. What are conditionals? When they are required in a program?
Answer – Conditionals are programming language elements used in computer science that execute various computations or actions based on whether a boolean condition supplied by the programmer evaluates to true or false.

When a software needs to calculate a result based on a given circumstance, they are necessary (s).

14. Following is an algorithm for going to school or college. Can you suggest improvements in this to include other options?
Reach_School_Algorithm
a) Wake up
c) Take lunch box
d) Take bus
e) Get off the bus
f) Reach school or college
a) Wake up
c) Take bath
d) Dress up
e) Eat breakfast
f) Take lunch box
g) Take Bus
h) Get off the bus
i) Reach school or college

15. Write a pseudocode to calculate the factorial of a number (Hint: Factorial of 5, written as 5!=5 4 3 21 ×××× ).
INPUT num
SET fact := 1, i := 1
WHILE i <= num DO
CALCULATE fact := fact * i
INCREASE i by 1
END LOOP
PRINT fact

16. Draw 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 of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.

17. Following is an algorithm to classify numbers as “Single Digit”, “Double Digit” or “Big”.
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
INPUT Number
IF Number <= 9
“Single Digit”
Else If Number <= 99
“Double Digit”
Else
“Big”

18. For some calculations, we want an algorithm that accepts only positive integers upto 100.

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?