In pseudocode, which command is used to record a data item into an external file that has already been opened?
Cambridge IGCSE · Computer Science (0478)
File handling: Practice Questions
5 multiple-choice questions marked as you go, and 5 written questions with worked solutions. All on File handling.
A programmer needs to store a list of 1000 product IDs. Which statement best explains why they should use a file instead of only using a 1D array in the program?
Which statement is true regarding file handling as defined in the Cambridge IGCSE syllabus?
In the pseudocode command READFILE "Results.txt", StudentScore, what is the specific role of StudentScore?
Which of the following describes the correct function of the READFILE command in pseudocode?
State the pseudocode command used to read a data item from an external file and explain the role of the variable that must be provided with this command.
Write your answer out first, then check it against the worked solution.
A programmer needs to update a configuration file. Explain why opening a file in WRITE mode could be problematic if the file already contains important existing data.
Write your answer out first, then check it against the worked solution.
Explain two technical reasons why a programmer must include the CLOSEFILE command after a program has finished processing data in a file.
Write your answer out first, then check it against the worked solution.
A data logger records temperature values and stores them in a text file named "LogData.txt".
(a) State the pseudocode command and the specific mode used to open this file if the programmer wants to retrieve existing data from it.
(b) Name the specific pseudocode command used to read a single data item from this file into a variable.
(c) State the command used to finalize the process and release the file back to the system.
Write your answer out first, then check it against the worked solution.
A school uses a text file named "StudentData.txt" to store the names of students in a class. There are exactly \(30\) students. A program is required to read these names and transfer them into a 1D array for easier access during the school day.
Write a pseudocode algorithm that:
- Declares a 1D array named StudentNames with \(30\) elements.
- Opens the file "StudentData.txt" in the appropriate mode.
- Uses a count-controlled loop to read all names from the file and store each name into the array.
- Closes the file after the operation is complete.
Write your answer out first, then check it against the worked solution.
* The content provided by thinka is generated by AI and may not always be accurate or up-to-date. Please use it as a supplementary resource and verify with official materials.
You've seen the model answer. Now get yours marked.
This page can show you how a good answer looks. It cannot tell you what your answer was missing. thinka marks your written work against the real mark scheme in about 15 seconds.
Want more questions like these? Get a fresh set on this topic, graded as you go.
Practice More