Past-paper question · 2023 May-June · Paper 42 · Q2(a)

Question 2(a) 2023 · May-June · Paper 42 · 2 marks

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

Official answer for Question 2

Part (a)

Question 1

mark each

Question 2

✓
Record declaration named SaleData // class declaration (and end) named SaleData…
✓
…SaleID declared as string, Quantity as integer in record
✓
// if a class then a constructor assigning attributes SaleID and Quantity
✓
Example Program code:
✓
Java
✓
class SaleData{
✓
private String SaleId;
✓
private Integer Quantity;
✓
public SaleData(String SaleIDP, Integer Quantityp){
✓
SaleId = SaleIDP;
✓
Quantity = Quantityp;
✓
}
✓
}
✓
VB.NET
✓
Structure SaleData
✓
Public SaleID As String
✓
Public Quantity As Integer
✓
End Structure
✓
Python
✓
class SaleData:
✓
def __init__(self, SaleIDp, Quantityp):
✓
self.SaleID = SaleIDp #string
✓
self.Quantity = Quantityp #integer
✓
9618/42
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2023
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_s23_ms_42.pdf →

Show text version of question

Question 2

Part (a)

Question 2

A business sells a single product. Customers can purchase one or more of this product.

Each sale has an ID and a quantity, for example "ABC" and 2

The business needs a program to store the data about the sales in a circular queue data structure.

Part (a)

Write program code to declare a record structure, SaleData, to store the data about each

sale.

Save your program as Question2_J2023.

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

[2]
Topic relevance

Why this question appears here

82% assigned-topic match · Data types and structures › Data types and records

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

Keep practising this topic