Question 19(d)(ii) 2016 · October-November · Paper 21 · 18 marks
Reveal official mark-scheme answer
The answer for this question is in the official mark scheme: open the mark scheme.
Show text version of question
Question 19
Part (d)
(ii)
Question 19
ENDWHILE
Question 7
(ii)
State two things that built-in and user-defined functions have in common.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
.......................................................................................................................................[2]
Question 13
4 A company employs Ahmed as a programmer.
Part (a)
At College, before joining the company, Ahmed used two items of software for programming:
- a text editor
- a compiler
Describe how he could have developed programs using these software tools.
Include in the description the terms ‘object code’ and ‘source code’.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
Part (b)
Ahmed now uses an Integrated Development Environment (IDE) for programming.
(i)
State one feature an IDE provides to help with the identification of syntax errors.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii)
State one feature an IDE provides to carry out white box testing.
...........................................................................................................................................
.......................................................................................................................................[1]
Part (c)
The company maintains a file of product data. Ahmed is to write a program to add a new
product and search for a product based on the structure diagram shown:
Product processing
Add Search for product product
By By By product code description price
Question 14
The program records the following data for each product:
- product code
- product description
- product retail price
The text file PRODUCTS stores each data item on a separate line, as shown below:
File PRODUCTS 0198 Plums(10kg) 11.50 0202 Onions(20kg) 10.00
0376 Mango chutney(1kg) 02.99
0014 Mango(10kg) 12.75
The program uses the variables shown in the identifier table.
Identifier Data type Description
Storing the code, description and PRODUCTS TEXT FILE retail price for all current products PCode ARRAY[1:1000] OF STRING Array storing the product codes PDescription ARRAY[1:1000] OF STRING Array storing the product descriptions PRetailPrice ARRAY[1:1000] OF REAL Array storing the product retail prices i INTEGER Array index used by all three arrays
Question 15
(i)
The first operation of the program is to read all the product data held in file PRODUCTS
and write them into the three 1D arrays.
Complete the pseudocode below.
OPEN ................................................................................................................................
i 1
WHILE ..............................................................................................................................
READFILE ("PRODUCTS", ......................................................................................)
READFILE ("PRODUCTS", ......................................................................................)
READFILE ("PRODUCTS", ......................................................................................)
.......................................................................................................................................
.......................................................................................................................................
ENDWHILE
CLOSE "PRODUCTS"
OUTPUT "Product file contents written to arrays"
When Ahmed designed the PRODUCTS file, File PRODUCTS he considered the alternative file structure shown opposite. 0198 Plums(10kg) 11.50 0202 Onions(20kg) 10.00 It stores one product per line in the text file.
0376 Mango chutney(1kg) 02.99
0014 Mango(10kg) 12.75
(ii)
State one benefit and one drawback of this file design.
Benefit ...............................................................................................................................
...........................................................................................................................................
Drawback ..........................................................................................................................
.......................................................................................................................................[2]
Question 16
Part (d)
To code the ‘Search by product code’ procedure, Ahmed draws a structure chart showing the
different stages.
The procedure uses the variables shown in the identifier table.
Identifier Data type Description
SearchCode STRING Product code input by the user Array index position for the ThisIndex INTEGER corresponding product ThisDescription STRING Product description found ThisRetailPrice REAL Product retail price found
You can assume that before the procedure is run, all the product data is read from file PRODUCTS and then stored in three 1D arrays as described in part (c)(i).
Label the structure chart to show the input(s) and output(s).
Lookup by product code ......................
...................... ......................
................. ................ ......................
......................
INPUT Search for OUTPUT details search criteria product code
Question 17
Why this question appears here
87% assigned-topic match · Data types and structures › Arrays
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 9608_w16_qp_21.pdf
