Question 8(a) 2015 · October-November · Paper 21 · 1 mark
Reveal official mark-scheme answer
Official answer for Question 8
Part (a)
Part (a)
r
Show text version of question
Question 8
Part (a)
Question 8
In this question you will need to use the given pseudocode built-in function:
ONECHAR(ThisString : STRING, Position : INTEGER) RETURNS CHAR returns the single character at position Position (counting from the start of the string with value 1) from the string ThisString. For example: ONECHAR("Barcelona", 3) returns 'r'.
Part (a)
Give the value assigned to variable y by the following statement:
y ← ONECHAR("San Francisco", 6) y .............................................
of two fractions. Each part of the fraction within the string is always a single digit only and the top digit is always less than the bottom digit.
Example strings are: "3/8+3/5" and "5/8-1/4"
The program steps are:
- the user enters the string
- the program isolates each digit and the operator
- the program computes the answer as either:
- the program displays the answer to the user
a fraction a whole number followed by a fraction a whole number
Op
é
N4Char N3Char N2Char N1Char
The identifier table shows the variables to be used to store the characters in the string as shown in the diagram.
Identifier Data type Description
FractionString String input by user. STRING For example: "5/8-1/4" N1Char CHAR See diagram N2Char CHAR See diagram N3Char CHAR See diagram N4Char CHAR See diagram Op CHAR See diagram
Question 17
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 9608_w15_qp_21.pdf
