Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Write pseudocode to handle text files that consist of one or more lines
Learning Objective/s:
  • Describe file modes (read, write, append) and the purpose of opening and closing files.
  • Explain how to detect end‑of‑file and use READLINE/WRITELINE in pseudocode.
  • Apply common file‑handling patterns to write correct pseudocode for reading, writing and appending text files.
  • Identify and correct typical file‑handling errors in pseudocode.
Materials Needed:
  • Projector or interactive whiteboard
  • Slide deck showing pseudocode syntax and patterns
  • Handout of file‑handling operations table
  • Sample text files (e.g., data.txt, numbers.txt)
  • IDE or pseudocode editor for student practice
  • Worksheet with practice exercises
Introduction:

Start with a quick question: “How does a program get data from a file?” Connect this to prior learning about variables and loops. Explain that today’s success criteria are to write correct pseudocode for opening, processing, and closing a text file while handling EOF.

Lesson Structure:
  1. Do‑now (5'): Students list three file modes and guess their purposes.
  2. Mini‑lecture (10'): Present file‑handling syntax and common patterns with the slide deck.
  3. Guided practice (12'): Walk through reading a file line‑by‑line, pausing for student input on each step.
  4. Partner activity (15'): Students complete a worksheet that asks them to write pseudocode for writing and appending files.
  5. Whole‑class review (8'): Share solutions, highlight common errors, and discuss how to avoid them.
  6. Exit ticket (5'): Each student writes one line of pseudocode to close a file correctly.
Conclusion:

Recap the sequence: open → loop with EOF test → process → close, and remind students of the typical pitfalls. Collect exit tickets and assign homework: create pseudocode that reads a file of integers, calculates sum, average, and counts even numbers.