Past-paper question · 2023 October-November · Paper 22 · Q8(b)(i)

Question 8(b)(i) 2023 · October-November · Paper 22 · 49 marks

Original past-paper question for 8(B)(I)
Original past-paper question for 8(B)(I)
Original past-paper question for 8(B)(I)
Original past-paper question for 8(B)(I)
Original past-paper question for 8(B)(I)
Original past-paper question for 8(B)(I)
Reveal official mark-scheme answer

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 9618_w23_ms_22.pdf →

Show text version of question

Question 8

Part (b)

(i)

Question 8

[5]

Question 7

Part (b)

The original linked list is to be modified. A new node D6 is inserted between nodes D32 and

D11.

Ptr1 D40 D32 D11 D100 Ø

Ptr2 F1 F2 F3 F4 Ø

The algorithm required is expressed in four steps as shown.

Complete the steps.

1. Assign the data item .................................. to .................................. .

2. Set the .................................. of this node to point to .................................. .

3. Set Ptr2 to point to .................................. .

4. Set pointer of .................................. to point to .................................. .

[4]

Question 8

4 A procedure Count() will:

1. input a value (all values will be positive integers) 2. count the number of odd values and count the number of even values 3. repeat from step 1 until the value input is 99 4. output the two count values, with a suitable message.

The value 99 must not be counted. The procedure Count() is to be tested.

Typical test data would consist of odd and even values, for example:

The purpose of this test would be to test a typical mix of even and odd values and check the totals.

Give three test data sequences that may be used to test different aspects of the procedure.

Do not include invalid data.

Sequence 1:

Test data ...................................................................................................................................

Purpose of test. ........................................................................................................................

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

Sequence 2:

Test data ...................................................................................................................................

Purpose of test. ........................................................................................................................

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

Sequence 3:

Test data ...................................................................................................................................

Purpose of test. ........................................................................................................................

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

[3]

Question 10

5 A global 1D array of integers contains four elements, which are assigned values as shown:

Mix[1] ←1 Mix[2] ←3 Mix[3] ←4 Mix[4] ←2

A
procedure Process() manipulates the values in the array.

The procedure is written in pseudocode:

PROCEDURE Process(Start : INTEGER) DECLARE Value, Index, Count : INTEGER

Index ← Start Count ←0 REPEAT Value ←Mix[Index] Mix[Index]← Mix[Index] - 1 Index ←Value Count ←Count + 1 UNTIL Count = 5

Mix[4] ← Count * Index ENDPROCEDURE

Complete the trace table on the opposite page by dry running the procedure when it is called as follows:

CALL Process(3)

Question 11

Index Value Count Mix[1] Mix[2] Mix[3] Mix[4]

[6]

Question 12

Question 6

Part (a)

A procedure CreateFiles() will take two parameters:

  • a string representing a file name
  • an integer representing the number of files to be created.

The procedure will create the number of text files specified.

Each file is given a different name. Each file name is formed by concatenating the file name with a suffix based on the file number. The suffix is always three characters.

For example, the call CreateFiles("TestData", 3) would result in the creation of the three files, TestData.001, TestData.002 and TestData.003.

Each file will contain a single line. For example, file TestData.002 would contain the string:

This is File TestData.002

Write pseudocode for CreateFiles().

Assume both parameters are valid and that the integer value is between 1 and 999, inclusive.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[6]

Question 13

Part (b)

A module CheckFiles() will count the number of files produced by CreateFiles() in

part (a).

CheckFiles() will take a string representing a file name and return the number of files found.

(i)

Identify the type of module that should be used for CheckFiles().

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

[1]
Topic relevance

Why this question appears here

75% assigned-topic match · Software development › Program testing and maintenance

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 9618_w23_qp_22.pdf

Keep practising this topic