SHSubjectHub

File Handling & SQL

OCR J2772.2eGCSELesson packSubscription
Also online

This worksheet marks itself

Set it as homework or classwork and every answer is marked as pupils go, with feedback on what they got wrong. The scores go straight into your mark book, so you can see who needs help before the next lesson.

  • 8 questions
  • 24 marks
  • about 18 minutes
  • marked instantly

Question types: matching, multiple choice, true or false, multi-part, short answer.

Try one from this worksheet

A file called "log.txt" already contains 5 lines of data. A program opens the file using mode "w" and writes one new line. How many lines does the file now contain?

Pick an answer: it's marked straight away, just as your pupils would see it.

About this resource

Read from and write to text files, understand file modes, and use SQL to query databases with SELECT, FROM, WHERE, LIKE, AND, and OR.

15 slides.

Lesson outline

  1. Why Use Files?
  2. File Modes
  3. Reading from a File
  4. Writing to a File
  5. Code Demo: File Reading and Writing
  6. Task: File Handling Practice
  7. Coding Challenge: Contact Book
  8. Introduction to SQL
  9. SQL: SELECT and WHERE
  10. SQL: LIKE for Pattern Matching
  11. SQL Query Check
  12. Task: Write SQL Queries
Unit bundle2.2 Programming Fundamentals
Part of: 2.2 Programming Fundamentals: the whole unitEvery resource in the unit in one zip.

More from 2.2 Programming Fundamentals