Pascal Programming Practices

1. Problem Analysis (Competency Level 10.1)

Exercise 1.1: Input/Output Basics

  • Description : Write a program that asks the user for their name and age, then prints a personalized greeting like:
    “Hello [Name]! You are [Age] years old.”
  • Syllabus Coverage : Identification of inputs (name, age) and outputs (greeting).
  • Aim : Teach students how to identify inputs and outputs and implement basic input/output operations.

Exercise 1.2: Area of a Rectangle

  • Description : Write a program that calculates the area of a rectangle. The user should input the length and width, and the program should output the area.
  • Syllabus Coverage : Problem analysis (inputs: length, width; output: area).
  • Aim : Introduce students to simple mathematical computations and problem-solving.

2. Control Structures (Competency Levels 10.2, 10.6, 10.7)

Selection (IF-Else, Case/Switch)

Exercise 2.1: Positive, Negative, or Zero
  • Description : Write a program that checks if a number entered by the user is positive, negative, or zero. Use if-else statements.
  • Syllabus Coverage : Selection control structure.
  • Aim : Teach students how to use conditional statements to make decisions.

Exercise 2.2: Simple Calculator
  • Description : Create a simple calculator where the user can choose an operation (+, -, *, /) using a case statement. The program should perform the selected operation on two numbers provided by the user.
  • Syllabus Coverage : Selection control structure with multiple conditions.
  • Aim : Reinforce the use of case statements and arithmetic operators.

Iteration (Loops)

Exercise 2.3: Even Numbers from 1 to 50
  • Description : Write a program that prints all even numbers from 1 to 50 using a for loop.
  • Syllabus Coverage : Iteration control structure.
  • Aim : Introduce students to loops and repetitive tasks.

Exercise 2.4: Factorial of a Number
  • Description : Write a program that calculates the factorial of a number entered by the user using a while loop.
  • Syllabus Coverage : Iteration control structure with unknown iterations.
  • Aim : Teach students how to use loops for mathematical computations.

Exercise 2.5: Guess the Secret Number
  • Description : Write a program that asks the user to guess a secret number (e.g., 7). The program should keep asking until the user guesses correctly, using a repeat-until loop.
  • Syllabus Coverage : Iteration control structure with condition checking at the end.
  • Aim : Reinforce the use of loops and introduce game-like programming.


3. Data Types and Operators (Competency Levels 10.4, 10.5)

Exercise 3.1: Swap Two Variables

  • Description : Write a program that swaps the values of two variables without using a third variable. Use arithmetic operators.
  • Syllabus Coverage : Variables, data types, and arithmetic operators.
  • Aim : Teach students how to manipulate variables and use operators effectively.

Exercise 3.2: Temperature Converter

  • Description : Write a program that converts temperature from Celsius to Fahrenheit and vice versa. Allow the user to choose the conversion type using logical operators.
  • Syllabus Coverage : Logical and arithmetic operators.
  • Aim : Reinforce the use of operators and decision-making.

Exercise 3.3: Leap Year Checker

  • Description : Write a program that determines whether a year entered by the user is a leap year. A leap year is divisible by 4 but not by 100, unless it is also divisible by 400.
  • Syllabus Coverage : Logical and comparison operators.
  • Aim : Teach students how to apply logical conditions to solve real-world problems.


4. Arrays (Competency Level 10.9)

Exercise 4.1: Reverse Array

  • Description : Write a program that stores 5 student names in an array and prints them in reverse order.
  • Syllabus Coverage : One-dimensional arrays.
  • Aim : Introduce students to arrays and their basic operations.

Exercise 4.2: Largest and Smallest Numbers

  • Description : Write a program that finds the largest and smallest numbers in an array of integers.
  • Syllabus Coverage : Array operations (accessing and comparing values).
  • Aim : Reinforce the use of arrays and teach students how to process data stored in arrays.

Exercise 4.3: Average of Numbers

  • Description : Write a program that calculates the average of numbers stored in an array. Allow the user to input the numbers.
  • Syllabus Coverage : Array operations and arithmetic computations.
  • Aim : Combine arrays with mathematical operations to solve practical problems.


5. Sub-Programs (Competency Level 10.10)

Exercise 5.1: Square Function

  • Description : Write a program with a function that calculates the square of a number. Call this function from the main program to calculate the squares of multiple numbers.
  • Syllabus Coverage : Value-returning sub-programs.
  • Aim : Teach students how to modularize code using functions.

Exercise 5.2: Multiplication Table Procedure

  • Description : Write a program with a procedure that prints a multiplication table for a given number. Call this procedure from the main program.
  • Syllabus Coverage : Non-value-returning sub-programs.
  • Aim : Reinforce the use of procedures for reusable code.

Exercise 5.3: Prime Number Checker

  • Description : Write a program with a function that checks if a number is prime. Use this function to print all prime numbers between 1 and 100.
  • Syllabus Coverage : Combining functions with loops.
  • Aim : Teach students how to combine sub-programs with other control structures.

Spread the love