A-level Computing/CIE/Fundamental Problem-solving and Programming skills/Programming

Specification link

Programming basics

  • write a program in a high-level language
  • implement and write a program from a given design presented as either a program flowchart or pseudocode
  • write program statements for:
    • the declaration of variables and constants
    • the assignment of values to variables and constants
    • expressions involving any of the arithmetic or logical operators

(given pseudocode will use the following structures:

DECLARE <identifier> : <data type> // declaration
<identifier> ← <value> or <expression> // assignment)

Transferable skills

  • recognise the basic control structures in a high-level language other than the one chosen to be studied in depth
  • appreciate that program coding is a transferable skill

Selection

  • use an ‘IF’ structure including the ‘ELSE’ clause and nested IF statements
    • given pseudocode will use the following structure:

IF <condition>
THEN
<statement(s)>
ENDIF

  • or, including an ‘else’ clause:

IF <condition>
THEN
<statement(s)>
ELSE
<statement(s)>
ENDIF

  • use a ‘CASE’ structure
  • given pseudocode will use the following structure:

CASE OF <identifier>
<value 1>: <statement>
<value 2>: <Statement>
...
ENDCASE

  • alternatively:

CASE OF <identifier>
<value 1>: <statement>
<value 2>: <Statement>
...
OTHERWISE <statement>
ENDCASE

Iteration

  • use a ‘count controlled’ loop:
    • given pseudocode will use the following structure:

FOR <identifier> ← <value1> TO <value2>
<statement(s)>
ENDFOR

  • alternatively:

FOR <identifier> ← <value1> TO <value2> STEP <value3>
<statement(s)>
ENDFOR

  • use a ‘post-condition’ loop:
    • given pseudocode will use the following structure:

REPEAT
<statement(s)>
UNTIL <condition>

  • use a ‘pre-condition’ loop
    • given pseudocode will use the following structure:

WHILE <condition>
<statement(s)>
ENDWHILE

  • justify why one loop structure may be better suited to a problem than the others

Built-in functions

  • use a subset of the built-in functions and library routines supported by the chosen programming language. This should include those used for:
    • string/character manipulation
    • formatting of numbers
    • random number generator
  • use the information provided in technical documentation describing functions/procedures

Structured programming

  • use a procedure
  • explain where in the construction of an algorithm it would be appropriate to use a procedure
    • given pseudocode will use the following structure for procedure definitions:

PROCEDURE <identifier>
<statement(s)>
ENDPROCEDURE

  • a procedure may have none, one or more parameters
  • a parameter can be passed by reference or by value
  • show understanding of passing parameters by reference

PROCEDURE <identifier> (BYREF <identifier>: <datatype>)
<statement(s)>
ENDPROCEDURE

  • show understanding of passing parameters by value

PROCEDURE <identifier> (BYVALUE <identifier>: <datatype>)
<statement(s)>
ENDPROCEDURE

  • a call is made to the procedure using CALL <identifier> ()
  • use a function
  • explain where in the construction of an algorithm it is appropriate to use a function
  • use the terminology associated with procedures and functions: procedure/function header, procedure/function interface, parameter, argument, return value
    • given pseudocode will use the following structure for function definitions:
FUNCTION <identifier> RETURNS <data type> // function has no parameters<br>
<statement(s)><br>
ENDFUNCTION<br>
FUNCTION <identifier> (<identifier>: <data type>)<br>
RETURNS <data type> // function has one or more parameters<br>
<statement(s)><br>
ENDFUNCTION<br></code>
* a function is used in an expression, for example
<code>x ← SQRT(n)<br>
WHILE NOT EOF()
  • write programs containing several components and showing good use of resources