Past-paper question · 2023 February-March · Paper 22 · Q10(b)

Question 10(b) 2023 · February-March · Paper 22 · 6 marks

Original past-paper question for 10(B)
Original past-paper question for 10(B)
Reveal official mark-scheme answer Official mark-scheme answer for 10(B)

Official answer for Question 10

Part (b)

✓
One mark for using FUNCTION and ENDFUNCTION and RETURNS BOOLEAN

Question 6

✓
One mark for naming the function Same
✓
One mark for defining the two parameters correctly
✓
One mark for comparing the two parameters using ROUND
✓
One mark for correctly returning TRUE and FALSE
✓
One mark for correct function call
✓
Example definition:
✓
FUNCTION Same(A : INTEGER, B : REAL) RETURNS BOOLEAN
✓
IF A = ROUND(B,0)
✓
THEN
✓
RETURN TRUE
✓
ELSE
✓
RETURN FALSE
✓
ENDIF
✓
ENDFUNCTION
✓
Example call:
✓
Z Same(X,Y)

Mark scheme 0478_m23_ms_22.pdf →

Show text version of question

Question 10

Part (b)

Question 10

The variables X, Y and Z are used in a program: X stores a whole number, Y stores a decimal

number and Z stores a flag that can be set to TRUE or FALSE

Part (b)

The function Same(A,B) returns TRUE if the value of A is the same as the value of B when B

is rounded to the nearest whole number and FALSE otherwise.

Write pseudocode statements to:

  • define the function
  • call the function with X and Y and store the return value in Z

Function definition ....................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Function call .............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

[6]
Topic relevance

Why this question appears here

98% assigned-topic match · Programming › Programming concepts

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 0478_m23_qp_22.pdf

Keep practising this topic