Question 1(a) 2016 · May-June · Paper 21 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (a)
Part (a)
Example Pascal:
- correct procedure header & ending
- output symbol at either end of line
- output name
- output (2) spaces either side between name and symbol
Show text version of question
Question 1
Part (a)
Question 1
Zara wants to write a program to print a set of name labels for a group of students.
Each label will show the name surrounded by a border. There is one gap line above and below the name line. This gap line only has the border symbol at the start and end. There are two spaces between the border symbol and the name.
Here is a label example:
@@@@@@@@@@ @ @ @ FRED @ @ @ @@@@@@@@@@
The user will choose the border symbol for the set of labels.
Zara writes pseudocode for her program:
INPUT Symbol REPEAT INPUT Name LabelWidth ← LENGTH(Name) + 6 CALL PrintTop2Lines(Symbol, LabelWidth) CALL PrintNameLine(Symbol, Name) CALL PrintBottom2Lines(Symbol, LabelWidth) UNTIL Name = "NoName"
Part (a)
Write program code for the procedure
PrintNameLine(Symbol, Name)
Programming language ............................................................................................................
Code .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
Question 3
Zara uses top-down design and refines her solution:
PROCEDURE PrintTop2Lines(Symbol : CHAR, LabelWidth : INTEGER) CALL PrintGapLine(Symbol, LabelWidth) CALL PrintSymbolLine(Symbol, LabelWidth) ENDPROCEDURE
PROCEDURE PrintBottom2Lines(Symbol : CHAR, LabelWidth : INTEGER) CALL PrintSymbolLine(Symbol, LabelWidth) CALL PrintGapLine(Symbol, LabelWidth) ENDPROCEDURE
Why this question appears here
82% 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_s16_qp_21.pdf
