Past-paper question · 2025 May-June · Paper 41 · Q2(d)

Question 2(d) 2025 · May-June · Paper 41 · 2 marks

Original past-paper question for 2(D)
Original past-paper question for 2(D)
Original past-paper question for 2(D)
Reveal official mark-scheme answer Official mark-scheme answer for 2(D)

Official answer for Question 2

Part (d)

Question 1

mark each

Question 2

  • Calling StoreData with one array and filename
  • Calling StoreData with remaining 5 arrays and filename
✓
Example program code:
✓
Python
✓
StoreData(Red, "Red.txt")
✓
StoreData(Green, "Green.txt")
✓
StoreData(Blue, "Blue.txt")
✓
StoreData(Orange, "Orange.txt")
✓
StoreData(Yellow, "Yellow.txt")
✓
StoreData(Pink, "Pink.txt")
✓
VB.NET
✓
StoreData(Red, "Red.txt")
✓
StoreData(Green, "Green.txt")
✓
StoreData(Blue, "Blue.txt")
✓
StoreData(Orange, "Orange.txt")
✓
StoreData(Yellow, "Yellow.txt")
✓
StoreData(Pink, "Pink.txt")
✓
Java
✓
StoreData(Red, "Red.txt");
✓
StoreData(Green, "Green.txt");
✓
StoreData(Blue, "Blue.txt");
✓
StoreData(Orange, "Orange.txt");
✓
StoreData(Yellow, "Yellow.txt");
✓
StoreData(Pink, "Pink.txt");
✓
9618/41
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2025
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_s25_ms_41.pdf →

Show text version of question

Question 2

Part (d)

Question 2

A program reads data from a text file, splits the data depending on its content and stores the

separated data into different files.

The text file TheData.txt contains 72 lines of data. Each line of data has an integer number and a string colour that are separated by a comma. For example, the first line in the file is:

10,red

The integer is 10 and the string is "red"

The file contains six different colours: red, green, blue, orange, yellow, pink.

Part (d)

Each of the six colours has a blank text file where the numbers will be stored. The names of

these six text files are:

  • Blue.txt
  • Green.txt
  • Orange.txt
  • Pink.txt
  • Red.txt
  • Yellow.txt

The procedure SplitData() needs amending to call StoreData() six times, with each of the six colour arrays and the name of the text file that corresponds to that colour.

For example, StoreData() will be called with the red array and the file name "Red.txt"

Write program code to amend SplitData()

Save your program.

Copy and paste the program code into part 2(d) in the evidence document.

[2]
Topic relevance

Why this question appears here

68% assigned-topic match · Data types and structures › Arrays

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_s25_qp_41.pdf

Keep practising this topic