Past-paper question · 2014 May-June · Paper 31 · Q7(d)(ii)

Question 7(d)(ii) 2014 · May-June · Paper 31 · 11 marks

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

Official answer for Question 7

Part (d)

(ii)

✓
//binary tree search
✓
INPUT SearchAnimal
✓
IsFound ← FALSE
✓
Current ← RootPtr
✓
REPEAT
✓
IF SearchAnimal = Data[Current]
✓
THEN
✓
//found
✓
OUTPUT 'Found'
✓
IsFound ← TRUE
✓
ELSE
✓
IF SearchAnimal > Data[Current]
✓
THEN
✓
// move right
✓
Current ← RightPtr[Current] (A. =)
✓
ELSE
✓
Current ← LeftPtr[Current]
✓
ENDIF
✓
ENDIF
✓
UNTIL IsFound( = TRUE)
✓
// SearchAnimal = Data[Current]
✓
OR Current = 0
✓
IF Current = 0
✓
// IsFound = FALSE // NOT IsFound
✓
// IsFound = FALSE AND Current = 0
✓
THEN
✓
OUTPUT SearchAnimal ' Not Foundv

ENDIF[5]

✓
GCE A LEVEL – May/June 2014 9691 31

Mark scheme 9691_s14_ms_31.pdf →

Show text version of question

Question 7

Part (d)

(ii)

Question 7

2000

[4]

Part (d)

(i)

How many comparisons will be made to locate LION in the current tree?

[1]

(ii)

An algorithm is designed in pseudocode. It will search the binary tree for a particular

animal.

The algorithm uses the variables below:

Variable Data type Description

SearchAnimal STRING Animal to search for

Current INTEGER The array subscript for the item currently considered

IsFound BOOLEAN Flag set to TRUE when SearchAnimal is found

Question 10

Complete the algorithm below:

//binary tree search

INPUT

IsFound ← FALSE

Current ← RootPtr

REPEAT

IF

THEN

//found

OUTPUT 'Found'

IsFound ← TRUE

ELSE

IF SearchAnimal > Data[Current]

THEN

// move right

ELSE

Current ← LeftPtr[Current]

ENDIF

ENDIF

UNTIL OR Current = 0

IF

THEN

OUTPUT SearchAnimal ' not found'

ENDIF

[5]

Question 11

Many computer systems need to store and process real numbers.

A
computer uses two bytes to store a real number. The first (Byte 7) stores the mantissa and

the second (Byte 8), the exponent. Both mantissa and exponent use two’s complement.

(ii)

Without any working out, how can you recognise that this 16-bit pattern (Byte 7 and Byte

8) is a positive number?

[1]
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_s14_qp_31.pdf

Keep practising this topic