Question 7(a) 2015 · October-November · Paper 31 · 18 marks
Reveal official mark-scheme answer
Official answer for Question 7
Part (a)
Part (a)
More than one program loaded into memory at the same time
Show text version of question
Question 7
Part (a)
Question 7
. . . .
2000
Question 12
Part (c)
An algorithm is designed in pseudocode to search the binary tree for a particular city.
The algorithm uses the additional variables below:
Variable Data type Description SearchCity STRING City to search for Current INTEGER The array subscript for the item currently considered IsFound BOOLEAN Flags to TRUE when SearchCity is found
Complete the algorithm below:
// binary tree search
INPUT ................................................................................................................................ IsFound ← FALSE Current ← RootPtr REPEAT IF City[Current] = ............................................................................................. THEN // found OUTPUT "Found"
........................................................................................................................ ELSE IF SearchCity > City[Current] THEN // move right
........................................................................................................... ELSE Current ← LeftPtr[Current] ENDIF ENDIF UNTIL Current = 0 OR ...............................................................................................
IF ..................................................................................................................................... THEN OUTPUT SearchCity "Not Found" ENDIF
Question 13
6 A high-level programming language has a built-in function SumRange defined as follows:
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
7 The diagram shows the main memory contents of a computer system. It is controlled by a multi- programming operating system.
Operating System A B
Partition 1 PROG2
PROG7 PROG16
Unused
Partition 2 USER21 USER34 USER46 Unused
Part (a)
Define the term multi-programming.
...................................................................................................................................................
...............................................................................................................................................[1]
The main memory is divided into two partitions. Partition 1 is dedicated to batch processing.
The diagram shows:
- the operating system
- systems software (A and B)
- three batch programs (in Partition 1)
Why this question appears here
91% 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 9691_w15_qp_31.pdf
