Question 1(a) 2024 · May-June · Paper 42 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (a)
Question 1
mark each to max 6
Question 6
Show text version of question
Question 1
Part (a)
Question 1
A program outputs a main word. The program asks the user to enter the different words of 3 or
more letters that can be made from the letters in the main word. These are called the answers.
There are 3 files: Easy.txt, Medium.txt and Hard.txt. Each file has the main word on the first line. For example, the main word in Easy.txt is house.
The answers are stored in the file. Each answer is on a new line after the main word. For example, Easy.txt has 14 answers that can be made from the letters in house.
The words read from the text file are stored in the global array WordArray. The number of words that can be made from the letters in the main word is stored in the global variable NumberWords.
Part (a)
The procedure ReadWords():
- takes a file name as a parameter
- opens the file and reads in the data
- stores the main word in the first element in WordArray
- stores each answer in a new element in WordArray
- counts and stores the number of answers.
Write program code for the procedure ReadWords().
Save your program as Question1_J24.
Copy and paste the program code into part 1(a) in the evidence document.
Why this question appears here
71% assigned-topic match · Programming › Structured programming
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_s24_qp_42.pdf
