3.2 Programming

Students need a theoretical understanding of all the topics in this section for the exams even if the programming language(s) they have been taught do not support all of the topics. Written exams will always present algorithms and code segments using the current version of the AQA pseudo-code document, which can be found on the AQA website, although students can present their answers to questions in any suitable format and do not need to use the AQA pseudo-code when answering questions.

3.2.1 Data types

Content

Additional information

Understand the concept of a data type.

 

Understand and use the following appropriately:

  • integer
  • real
  • Boolean
  • character
  • string.

Depending on the actual programming language(s) being used by the students, these variable types may have other names. For example real numbers may be described as float. In exams we will use the general names given in this specification.

3.2.2 Programming concepts

Content

Additional information

Use, understand and know how the following statement types can be combined in programs:

  • variable declaration
  • constant declaration
  • assignment
  • iteration
  • selection
  • subroutine (procedure/function).

The three combining principles (sequence, iteration/repetition and selection/choice) are basic to all imperative programming languages.

Students should be able to write programs using these statement types. They should be able to interpret algorithms that include these statement types.

Students should know why named constants and variables are used.

Use definite and indefinite iteration, including indefinite iteration with the condition(s) at the start or the end of the iterative structure.

A theoretical understanding of condition(s) at either end of an iterative structure is required, regardless of whether they are supported by the language(s) being used.

An example of definite iteration would be:

An example of indefinite iteration with the condition at the start would be:

An example of indefinite iteration with the condition at the end would be:

Use nested selection and nested iteration structures.

An example of nested iteration would be:

An example of nested selection would be:

Use meaningful identifier names and know why it is important to use them.

Identifier names include names for variables, constants and subroutine names.

3.2.3 Arithmetic operations in a programming language

Content

Additional information

Be familiar with and be able to use:

  • addition
  • subtraction
  • multiplication
  • real division
  • integer division, including remainders.

Integer division, including remainders is usually a two stage process and uses modular arithmetic:

eg the calculation 11/2 would generate the following values:

Integer division: the integer quotient of 11 divided by 2 (11 DIV 2) = 5

Remainder: the remainder when 11 is divided by 2 (11 MOD 2) = 1

3.2.4 Relational operations in a programming language

Content

Additional information

Be familiar with and be able to use:

  • equal to
  • not equal to
  • less than
  • greater than
  • less than or equal to
  • greater than or equal to.

Students should be able to use these operators within their own programs and be able to interpret them when used within algorithms. Note that different languages may use different symbols to represent these operators.

In assessment material we will use the following symbols:

=, ≠, <, >, ≤, ≥

3.2.5 Boolean operations in a programming language

Content

Additional information

Be familiar with and be able to use:

  • NOT
  • AND
  • OR.

Students should be able to use these operators, and combinations of these operators, within conditions for iterative and selection structures.

3.2.6 Data structures

Content

Additional information

Understand the concept of data structures.

It may be helpful to set the concept of a data structure in various contexts that students may already be familiar with. It may also be helpful to suggest/demonstrate how data structures could be used in a practical setting.

Use arrays (or equivalent) in the design of solutions to simple problems.

Only one and two-dimensional arrays are required.

Use records (or equivalent) in the design of solutions to simple problems.

 

3.2.7 Input/output and file handling

Content

Additional information

Be able to obtain user input from the keyboard.

 

Be able to output data and information from a program to the computer display.

 

Be able to read/write from/to a text file.

 

3.2.8 String handling operations in a programming language

Content

Additional information

Understand and be able to use:

  • length
  • position
  • substring
  • concatenation
  • convert character to character code
  • convert character code to character
  • string conversion operations.

Expected string conversion operations:

  • string to integer
  • string to real
  • integer to string
  • real to string.

3.2.9 Random number generation in a programming language

Content

Additional information

Be able to use random number generation.

Students will be expected to use random number generation within their computer programs. An understanding of how pseudo-random numbers are generated is not required.

3.2.10 Subroutines (procedures and functions)

Content

Additional information

Understand the concept of subroutines.

Know that a subroutine is a named ‘out of line’ block of code that may be executed (called) by simply writing its name in a program statement.

Explain the advantages of using subroutines in programs.

 

Describe the use of parameters to pass data within programs.

Students should be able to use subroutines that require more than one parameter.

Students should be able to describe how data is passed to a subroutine using parameters.

Use subroutines that return values to the calling routine.

Students should be able to describe how data is passed out of a subroutine using return values.

Know that subroutines may declare their own variables, called local variables, and that local variables usually:

  • only exist while the subroutine is executing
  • are only accessible within the subroutine.
 

Use local variables and explain why it is good practice to do so.

 

3.2.11 Structured programming

Content

Additional information

Describe the structured approach to programming.

Students should be able to describe the structured approach including modularised programming, clear, well documented interfaces (local variables, parameters) and return values.

Teachers should be aware that the terms 'arguments' and 'parameters' are sometimes used but in examinable material we will use the term 'parameter' to refer to both of these.

Explain the advantages of the structured approach.

 

3.2.12 Robust and secure programming

Content

Additional information

Be able to write simple data validation routines.

Students should be able to use data validation techniques to write simple routines that check the validity of data being entered by a user.

The following validation checks are examples of simple data validation routines:

  • checking if an entered string has a minimum length
  • checking if a string is empty
  • checking if data entered lies within a given range (eg between 1 and 10).

Be able to write simple authentication routines.

Students should be able to write a simple authentication routine that uses a username and password. Students will only be required to use plain text usernames and passwords (ie students will not need to encrypt the passwords).

Be able to select suitable test data that covers normal (typical), boundary (extreme) and erroneous data.

Be able to justify the choice of test data.

 

3.2.13 Classification of programming languages

Content

Additional information

Know that there are different levels of programming language:

  • low-level language
  • high-level language.

Explain the main differences between low-level and high-level languages.

Students should understand that most computer programs are written in high-level languages and be able to explain why this is the case.

Know that machine code and assembly language are considered to be low-level languages and explain the differences between them.

Understand that processors execute machine code and that each type of processor has its own specific machine code instruction set.

Understand that assembly language is often used to develop software for embedded systems and for controlling specific hardware components.

Understand that assembly language has a 1:1 correspondence with machine code.

Understand that ultimately all programming code written in high-level or assembly languages must be translated into machine code.

Understand that machine code is expressed in binary and is specific to a processor or family of processors.

 

Understand the advantages and disadvantages of low-level language programming compared with high-level language programming.

 

Understand that there are three common types of program translator:

  • interpreter
  • compiler
  • assembler.

Explain the main differences between these three types of translator.

Understand when it would be appropriate to use each type of translator.