An algorithm is developed in pseudocode before being coded in a programming language.
- (a)The following table shows four valid pseudocode assignment statements. Complete the table by giving an appropriate data type to declare each of the variables A, B, C and D. Assignment statement Data type A ← LEFT(MyName, 1) B ← Total * 2 C ← INT(ItemCost) / 3 D ← "Odd OR Even"[4]
- (b)Other variables in the program have example values as shown: Variable Value Sorted False Tries 9 ID "ZGAC001" Complete the table by evaluating each expression, using the example values. Expression Evaluates to Tries < 10 AND NOT Sorted Tries MOD 4 TO_LOWER(MID(ID, 3, 1)) LENGTH(ID & "xx") >= Tries[4]
- (c)(i)The variable names A, B, C and D in part (a) are not good programming practice. (i) State why these variable names are not suitable.[1]
- (c)(ii)(ii) Identify one problem that these variable names might cause.[1]
- (c)(iii)(iii) The choice of suitable variable names is one example of good programming practice. Give one other example.[1]
Mark scheme
Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.
- [4] One mark per row
- CHAR / STRING
- INTEGER / REAL
- REAL
- STRING
- [4] One mark per row
- TRUE
- 1
- 'a' // "a"
- TRUE
- [1] The names do not reflect / indicate the purpose of the variable // the names are not meaningful
- [1] They make the program more difficult to understand / debug / maintain
- [1] One mark from:
- • Indentation / use of white space
- • Capitalisation of keywords
- • Use of comments
- • Use of modular programming
- • Use of local variables
- Note: max 1 mark
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →