Question 6 2015 · October-November · Paper 31 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (a)
(i)
SumRange
Question 1
Question 1
Show text version of question
Question 6
SumRange(ThisInteger1 : INTEGER, ThisInteger2 : INTEGER [Flag : CHAR]) RETURNS INTEGER returns the integer value calculated as the sum of all integers between ThisInteger1 and ThisInteger2. The square brackets denote that Flag is optional. It takes values as follows: • 'Y' – denotes both boundary values are to be included • 'N' – denotes both boundary values will not be included If Flag is omitted, both boundary values are included. For example: SumRange(3, 6, 'Y') returns 18 SumRange(3, 6, 'N') returns 9 An error is generated if: • The function is not properly formed, or • ThisInteger2 is less than ThisInteger1
(i)
State the function name and parameters for the above function. Function name .......................................................................................................................... Parameters ............................................................................................................................... ...............................................................................................................................................[2] What value is returned from the following function calls?
(ii)
SumRange(1, 3) ...............................................................................................................................................[1]
(iii)
SumRange("31", "33", 'Y') ...............................................................................................................................................[1]
(iv)
SumRange(1.5, 4.5) ...............................................................................................................................................[1]
(v)
SumRange(4, 7, 'N') ...............................................................................................................................................[1]
(vi)
SumRange(7, 4, 'N') ...............................................................................................................................................[1]
Question 14
Why this question appears here
82% assigned-topic match · Hardware › Logic gates and logic circuits
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 9691_w15_qp_31.pdf
