Question 6 2016 · October-November · Paper 22 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 6
(i)
10 / 10.0
(ii)
18.4
(iii)
41
(iv)
TRUE
(v)
12.4
Question 22
Question 22
Question 22
Show text version of question
Question 6
Study the sequence of pseudocode statements.
CONST a = 3.2 : REAL DECLARE x, y, z, Answer1, Answer2, Answer3 : REAL DECLARE p, q : BOOLEAN x 3 x x + 7 y 6 Answer1 2 * (a + y) z 6 Answer2 y ^ 2 + 5 p TRUE q NOT(NOT(p)) Answer3 y + a * 2
Give the final value assigned to each variable.
(i)
x .............................................
(ii)
Answer1 .............................................
(iii)
Answer2 .............................................
(iv)
q .............................................
(v)
Answer3 .............................................
Question 18
Appendix Built-in functions (pseudocode)
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("New York", 5) returns 'Y'
CHARACTERCOUNT(ThisString : STRING) RETURNS INTEGER
returns the number of characters in ThisString.
For example: CHARACTERCOUNT("New York") returns 8
SUBSTR(ThisString : STRING, Value1 : INTEGER, Value2 : INTEGER) RETURNS STRING
returns a sub-string from within ThisString. Value1 is the start index position (counting from the left, starting with 1). Value2 is the final index position.
For example: SUBSTR("art nouveau", 5, 11) returns "nouveau"
TONUM(ThisString : STRING) RETURNS INTEGER or REAL
returns the integer or real equivalent of the string ThisString.
For example: TONUM("502") returns the integer 502 TONUM("56.36") returns the real number 56.36
ASC(ThisCharacter : CHAR) RETURNS INTEGER
returns an integer which is the ASCII character code for the character ThisCharacter.
For example: ASC('A') returns integer 65
Question 19
CHR(Value : INTEGER) RETURNS CHAR
returns the character that ASCII code number Value represents.
For example: CHR(65) returns 'A'
RND() RETURNS REAL
returns a random number in the range 0 to 0.99999
For example: RND() returns 0.67351
INT(ThisNumber : REAL) RETURNS INTEGER
returns the integer part of ThisNumber.
For example: INT(12.79) returns 12
Errors
For any function, if the program calls the function incorrectly, the function returns an error.
Concatenation operator
& operator – Concatenates two expressions of STRING or CHAR data type.
For example: "South" & " " & "Pole" produces "South Pole" 'B' & "000654" produces "B000654"
Question 20
effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.
Why this question appears here
99% 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_w16_qp_22.pdf
