Computer Science - 9210 OxfordAQA

Input/output And File Handling

Overview

Close a program and everything it was holding disappears. Every variable, every array, every record: gone the instant the process ends, because they lived in memory and memory is handed back. A high score that survives until tomorrow, a register that is still there next term, a saved game: all of them require the program to push its data across a boundary, out of itself and onto something that outlives it.

This lesson covers the three things the specification asks for. Obtaining user input from a keyboard, outputting data and information from a program to the computer display, and reading from and writing to a text file. You will learn why everything typed at a keyboard arrives as text whatever it looks like, how a program knows when a file has run out, and the difference between writing to a file and adding to one, which is the difference between saving today's readings and destroying every reading you ever took.

Objectives

  1. Be able to obtain user input from a keyboard. Be able to output data and information from a program to the computer display. Be able to read/write from/to a text file.

Mind map

This topic is mapped out so you can see how the ideas connect.

Open the mind map in the app

Lesson Note

Everything a program does divides into three regions, and you met them when you learned to read an algorithm. Input is where data crosses into the program from outside. Processing is everything that happens to data the program already holds. Output is where data crosses back out. This topic is about the two crossings, and the specification names four of them: obtaining input from a keyboard, sending output to the computer display, reading from a text file, and writing to a text file.

Complete Note Available on the Green Bridge App

Get the Green Bridge CBT app on your phone or computer for the complete IGCSE library: past papers, mark schemes, mind maps, flashcards and audio lessons.

Full lesson notes with diagrams
AI-powered learning assistant
Timed mock exams marked the moment you finish
Available on Android, Windows, macOS, and Linux iOS app coming soon

Lesson Evaluation

Congratulations on completing the lesson on Input/output And File Handling. Now that youve explored the key concepts and ideas, its time to put your knowledge to the test. This section offers a variety of practice questions designed to reinforce your understanding and help you gauge your grasp of the material.

You will encounter a mix of question types, including multiple-choice questions, short answer questions, and essay questions. Each question is thoughtfully crafted to assess different aspects of your knowledge and critical thinking skills.

Use this evaluation section as an opportunity to reinforce your understanding of the topic and to identify any areas where you may need additional study. Don't be discouraged by any challenges you encounter; instead, view them as opportunities for growth and improvement.

  1. What data type does a value obtained from a keyboard have before any conversion? A. Boolean B. Integer C. Real D. String Answer: D
  2. A program opens an existing text file in write mode. What happens to the data already in the file? A. It is kept and new data is added at the end B. It is kept and new data is added at the start C. It is destroyed D. The program refuses to open the file Answer: C
  3. Which loop structure is most appropriate for reading every line of a text file whose length is not known? A. A FOR loop from 0 to the number of lines B. A WHILE loop testing for the end of the file C. A FOR loop from 1 to 100 D. No loop is needed Answer: B
  4. Why should a program close a file it has written to? A. To force any buffered data out to the disk and release the file B. To convert the data into text C. To sort the contents of the file D. To make the file readable by a person Answer: A
  5. A program stores data in a file rather than in an array. What is the main advantage? A. The data can be sorted more quickly B. The data survives after the program ends C. The data does not need to be converted D. The data uses less memory while the program runs Answer: B

Work through these questions in the app

Work through these questions in the app

Practice Mock Questions

Want to practice mock questions on Input/output And File Handling? Download the Green Bridge CBT app to access mock questions and full practice assessments for this topic.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning