Tutorial 2: Algorithm & Problem Solving (I)
PART A – Remember & Understand (C1–C2)
Exercise A1: Define / Identify / State
1. Define an algorithm.
2. Define problem solving in the context of computing.
3. State the meaning of problem framing.
4. Identify TWO types of inputs and outputs in a program.
5. Define pseudocode.
6. Define a flowchart.
Exercise A2: Classify / Distinguish / Explain
Classify each statement below as Pseudocode or Flowchart and justify your answer:
1. Writing step-by-step instructions in plain English.
2. Using symbols and arrows to represent the sequence of operations.
3. Easy to convert into a programming language.
4. Useful for visually representing loops and decisions.
PART B – Understand & Explain (C2)
Exercise B1: Explain / Describe
1. Explain why problem framing is important before writing an algorithm.
2. Describe the relationship between inputs, processing, and outputs.
3. Explain why flowcharts help in understanding complex problems.
4. Describe the purpose of using pseudocode in problem solving.
5. Explain how algorithms improve programming efficiency.
PART C – Apply & Differentiate (C3–C4)
Question 1 – Simple Calculation
Scenario: A shop wants a program to calculate the total price of items purchased by a
customer. The cashier inputs the quantity of items and the price per item.
Task: Draw a flowchart to calculate the total price and display it.
Question 2 – Decision Making
Scenario: A school wants to determine whether a student has passed or failed an exam. The
passing mark is 50. The program should accept the student’s score and display “Pass” if the
score is 50 or more, and “Fail” otherwise.
Task: Draw a flowchart to represent this decision-making process.
Question 3 – Largest of Three Numbers
Scenario: A program is needed to find the largest of three numbers entered by the user.
Task: Draw a flowchart to identify the largest number and display it.
Question 4 – Even or Odd
Scenario: A program needs to check whether a number entered by the user is even or odd.
Task: Draw a flowchart to display “Even” if the number is divisible by 2, and “Odd”
otherwise.
Question 5 – Grade Calculation
Scenario: A teacher wants a program to assign grades based on marks:
80–100 → A
60–79 → B
40–59 → C
Below 40 → F
Task: Draw a flowchart that reads a student’s marks and displays the correct grade.
Question 6 – ATM PIN Verification
Scenario: An ATM requires the user to enter a 4-digit PIN. If the PIN is correct, the system
displays “Access Granted.” If it is incorrect, the system displays “Access Denied.”
Task: Draw a flowchart showing the steps for PIN verification.
Question 7 – Sum of Natural Numbers
Scenario: A program should calculate the sum of all natural numbers from 1 to N, where N is
entered by the user.
Task: Draw a flowchart to calculate and display the sum.
Question 8 – Temperature Conversion
Scenario: A weather station wants a program to convert a temperature from Celsius to
Fahrenheit using the formula:
F = (C × 9/5) + 32
Task: Draw a flowchart to read Celsius, convert it, and display Fahrenheit.
Question 9 – Simple Banking Transaction
Scenario: A bank wants a program that allows a customer to:
• Enter account balance
• Choose an operation: Deposit or Withdraw
• Update the balance accordingly and display it
Task: Draw a flowchart to represent this process.
Question 10 – Factorial Calculation (Loop Example)
Scenario: A program should calculate the factorial of a number entered by the user.
Task: Draw a flowchart using a loop to multiply numbers from 1 to N and display the
factorial.
Question 1
Scenario:
A store wants to create a program that asks the user for their name and age, then prints a
greeting message along with the age.
Task:
Write pseudocode for this program.
Question 2
Scenario:
A school wants to check whether a student passes or fails an exam. Passing mark is 50.
Task:
Write pseudocode to:
1. Ask the user for their exam score.
2. If the score is 50 or more, display “Pass”.
3. Otherwise, display “Fail”.
Question 3
Scenario:
A shop sells 5 items and wants to calculate the total cost of items purchased.
Task:
Write pseudocode to:
1. Ask for the price of each item.
2. Calculate the total cost.
3. Display the total at the end.
Question 4
Scenario:
A user wants to perform a basic calculation (+, -, *, /) between two numbers.
Task:
Write pseudocode to:
1. Ask the user to input two numbers.
2. Ask the user to choose an operation (+, -, *, /).
3. Perform the operation and display the result.
4. If the operation is invalid, display “Invalid operation”.
Question 5
Scenario:
A cinema ticket booking system charges:
• RM10 for adults
• RM7 for children under 12
Task:
Write pseudocode to:
1. Ask the user for the number of adults and children.
2. Calculate the total price.
3. Display the total cost.