0% found this document useful (0 votes)
60 views3 pages

File Handling

The document provides instructions for three file handling tasks of increasing difficulty related to programming fundamentals. The tasks involve opening, reading, writing, and closing text files to store and retrieve data. The first task involves recording behavior points for a student in a text file. The second task reads a text file about Bill Gates and quizzes the user. The third task takes book title and publication year inputs from the user 100 times to generate book codes and store in a new text file. Python code and exam reference language code are required for each task.

Uploaded by

PollarOpposite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

File Handling

The document provides instructions for three file handling tasks of increasing difficulty related to programming fundamentals. The tasks involve opening, reading, writing, and closing text files to store and retrieve data. The first task involves recording behavior points for a student in a text file. The second task reads a text file about Bill Gates and quizzes the user. The third task takes book title and publication year inputs from the user 100 times to generate book codes and store in a new text file. Python code and exam reference language code are required for each task.

Uploaded by

PollarOpposite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

2.2.

3 Programming Fundamentals: File Handling Operations


Name: Tajnim Abdul Group: 10c/co1 Teacher: Mr De Bique
Date: 26/01/2023 Qualification GCSE Computer Science – Component 2
 The use of basic file handling operations:
o Open
o Read
SC o Write
o Close
 Combine the use of the programming constructs and fundamentals to create a
program to suit the scenario.
File Handling:
File handling is the storing and retrieving of data in a program. Data used in programs is lost once the program is closed. To
access data even when programs are closed, files are used. Data from programs are written to files and stored.

There are 3 tasks that you must complete, the tasks are differentiated by grade. Ensure you look at the marks when completing
the tasks. If you are struggling, use the OCR Exam reference guide to help you: https://www.ocr.org.uk/Images/558027-
specification-gcse-computer-science-j277.pdf
Once completed, try this on Python (You can either create an account using repl.it or if you have it downloaded use the IDE).
Please note, it may not be written in the same way as the reference language so you will need to read through the following
website to help you: http://computing.outwood.com/NEA/python/key-syntax.html identify the correct statements.

Task 1 (Grade 1-3)


Scenario: A teacher has asked you to create a program for behaviour points. Create a program that will ask for a reason, and
the number of points and record that in a text file called behaviour.txt. The file is only for one student.

Python

Exam Reference Language

Task 1 (Grade 4-6)

Scenario: Create a text file (notepad) that contains the following text and save it as Bill.txt:

William Henry Gates III (born October 28, 1955) is an American business magnate, software developer, investor, author,
and philanthropist. He is the co-founder of Microsoft Corporation. During his career at Microsoft, Gates held the positions
of chairman, chief executive officer (CEO), president and chief software architect, while also being the largest
individual shareholder until May 2014.[6] He is considered one of the best known entrepreneurs of the microcomputer
revolution of the 1970s and 1980s.

Using exam reference language read the text file until it reaches the end. Once it has reached the end it will ask for an input
stating ‘What is this file about?’, if the answer given is Bill Gates (upper or lowercase), the output will be ‘Great! You
were paying attention’, otherwise it will say ‘Oh dear! I think you need to read it again!’.
Python

Exam Reference Language

Task 1 (Grade 7-9)

Scenario: A library gives a book code made from the first three letters of the book title in Upper Case, followed by the last
two digits of the year the book was published.
For example, “Poetry from the War”, published in 2012 would be given the code POE12. The library needs to store the
details for 100 new books in a text file named newBook.txt.
Using Exam Reference write a program that will ask the end user to input the book title and year it was published 100 times.
It will store this in the text file newBook.txt. Once completed, code this in Python and screenshot the outcome here.
Python

Exam Reference Language

You might also like