Past-paper question · 2015 October-November · Paper 31 · Q7(d)(i)

Question 7(d)(i) 2015 · October-November · Paper 31 · 19 marks

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

Official answer for Question 7

Part (d)

(i)

Part (d)

(i)

Each program can use the processor in turn

Question 1

✓
For a time of 100 milliseconds // for the fixed time slice

Question 1

[2]

Mark scheme 9691_w15_ms_31.pdf →

Show text version of question

Question 7

Part (d)

(i)

Question 7

. . . .

2000

[4]

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

[6]

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 Partition 2 of the main memory is used for interactive programs. The low-level scheduler operates a round-robin strategy. It allocates a time slice of 100 milliseconds.

(i)

Explain what is meant by the term ‘round-robin’.

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

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

.......................................................................................................................................[2]

Topic relevance

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

Keep practising this topic