NCERT Solutions Class 11 Computer Science Chapter 4 Introduction to Problem Solving
NCERT Solutions Class 11 Computer Science Chapter 4 Introduction to Problem Solving: National Council of Educational Research and Training Class 11 Computer Science Chapter 4 Solutions – Introduction to Problem Solving. NCERT Solutions Class 11 Computer Science Chapter 4 PDF Download.
NCERT Solutions Class 11 Computer Science Chapter 4: Overview
Board |
NCERT |
Class |
11 |
Subject |
Computer Science |
Chapter |
4 |
Chapter Name |
Introduction to Problem Solving |
Topic |
Exercise Solutions |
NCERT Solutions Class 11 Computer Science Chapter 4 Introduction to Problem Solving
Question 3. Write the pseudocode to print all multiples of 5 between 10 and 25 (including both 10 and 25).
Answer:
FOR EACH I := 10 TO 15
IF I % 5 :=0 THEN
PRINT I
END IF
END LOOP
Question 4. Give an example of a loop that is to be executed a certain number of times.
Answer: Suppose we certain number starting from 11 to 16. The loop will be executed as follow:
SET i: = 11
FOR i: = 11 to 16 do
PRINT i
END LOOP
Question 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.
Answer:
Step 1: Set need Money := 0
Step 2: While Loop (need Money <200)
Do
Input money
Step 3: need Money : = need Money + money
Step 4: End Loop
Question 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.
Answer:
INPUT all_Item
INPUT price_for_each_Item
COMPUTE bill :=totalItem * price_for_each_Item
PRINT bill
COMPUTE tax := bill * (5 / 100)
COMPUTE bill_with_gst := bill + tax
PRINT bill_with_gst
Question 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.
Answer:
INPUT Computer_Science, maths, physics
COMPUTE aggregate := (Computer_Science + maths + physics) / 3
COMPUTE percentage := ((Computer_Science + math + physics) / 300) * 100
PRINT aggregate
PRINT percentage
Question8. Write an algorithm to find the greatest among two different numbers entered by the user.
Answer:
Step1: READ num1
Step2: READ num2
Step3:IF (num1 > num2)
PRINT num1
ELSE
PRINT num2
Step4: END
Question9. 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.
Answer:
Step 1: INPUT n
Step 2: IF n>5 And n<15 THEN
Step 3: PRINT “GREEN”
Step 4: ELSE IF n>15 And n<225 THEN
Step 5: PRINT “BLUE”
Step 6: ELSE IF n>25 And n<35 THEN
Step 7: PRINT “ORANGE”
Step 8: ELSE
PRINT “ALL COLOURS ARE BEAUTIFUL”
Step 9: End IF
Question 10. Write an algorithm that accepts four numbers as input and find the largest and smallest of them.
Answer:
Question11. 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 .
Answer:
Step 1: INPUT units
Setp 2: SET bill := 0
Step 3: IF units > 250 THEN
COMPUTE bill := units * 20
ELSE
IF units <= 100 THEN
COMPUTE bill := units * 5
ELSE
COMPUTE bill := 100 * 5 + (units – 100) * 10
END IF
Step 4: END IF
Step 5: COMPUTE total_Bill := bill + 75
Step 6: PRINT total_Bil
Question 12. What are conditionals? When they are required in a program?
Answer:
In programming conditionals are used for providing the condition to values, input and output. There are various conditional statements are there to evaluate the expression. Generally conditional statement give us a output in the form of true or false which is known as Boolean value.
Conditionals are required in program to check whether the value is satisfied with required output or not.
In case you are missed :- Previous Chapter Solution
Question 13. Match the pairs
Answer:
Question14. 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
b) Get ready
c) Take lunch box
d) Take bus
e) Get off the bus
f) Reach school or college
Answer:
- Wake up
- Brush our teeth
- Do some exercise
- Take a bath
- Get ready
- Take a breakfast
- Take a lunch box
- Go to bus stand
- Take a bus
- Get off the bus
- Reach school or college
Question 15. Write a pseudocode to calculate the factorial of a number (Hint: Factorial of 5, written as 5!=5 4 3 21 ×××× )
Answer:
INPUT number
SET factorial := 1, i := 1
WHILE i<= number DO
COMPUTE factorial := factorial * i
INCREASE i by 1
END LOOP
PRINT factorial
Question 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.
Answer:
Question 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.
Answer:
For given data,
5 and 9 are single digit number, so it will print “single digit”
47 and 99 are double digit number, so it will print “double digit”
100 and 200 is a three digit number, so it will print “big”
Correct algorithm:
Step 1: INPUT Number
Step 2: IF Number <= 9
“Single Digit”
Step 3: Else If Number <= 99
“Double Digit”
Step 4: Else
“Big”
Step 5: End IF
Question 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?
Answer:
a) On what values will this algorithm fail?
This algorithm fails at value 0. Because in condition we specify “greater than equal to operator”. So it will accept zero also.
b) Can you improve the algorithm?
Correct algorithm:
INPUT Number
IF (0<Number) AND (Number <= 100)
ACCEPT
Else
REJECT
In case you are missed :- Next Chapter Solution