3.2 Programming

Students need a theoretical understanding of all the topics in this section for the paper 1 exam even if the programming language(s) taught does not support all of the topics. Exams will always present algorithms using the current version of the AQA pseudo-code. The document can be found on the AQA website.

Students need a practical understanding of all the topics and skills in this section for the paper 1 exam. When they are writing computer programs in an exam they will need to ensure they use meaningful identifier names, use suitable data types and that all logic flow is clearly identifiable to examiners.

Exam questions will explicitly state in what form the response needs to be provided. This will be, for example, pseudo-code, program code or a flowchart, and students must respond as instructed. Where pseudo-code is an accepted method of response, students may present their answers to questions in any suitable format and do not need to use the AQA pseudo-code.

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, these data types may have other names. For example real numbers may be described as float. In exams we will use the general names given opposite.

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 high-level imperative programming languages.

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

Students should know why named constants and variables are used.

Use definite (count controlled) and indefinite (condition controlled) 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 (count controlled) iteration would be:

FOR i ← 1 TO 5
… Instructions here …
ENDFOR

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

WHILE NotSolved … 
Instructions here …
ENDWHILE

Examples of indefinite (condition controlled) iteration with the condition at the end would be:

REPEAT … 
Instructions here …
UNTIL Solved

DO 
… Instructions here …
WHILE NotSolved

Use nested selection and nested iteration structures.

An example of nested iteration would be:

WHILE NotSolved 
… Instructions here ...
FOR i ← 1 TO 5
… Instructions here …
ENDFOR
… Instructions here …
ENDWHILE

An example of nested selection would be:

IF GameWon THEN 
… Instructions here …
IF Score > HighScore THEN
… Instructions here …
ENDIF
… Instructions here …
ENDIF

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.

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.

An example of a record definition would be:

RECORD Car 
make : String
model : String
reg : String
price : Real
noOfDoors : Integer
ENDRECORD

3.2.7 Input/output

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.

 

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 Structured programming and subroutines (procedures and functions)

Content

Additional information

Understand the concept of subroutines.

Students should 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.

 
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.11 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).

Understand what is meant by testing in the context of algorithms and programs.

Be able to correct errors within algorithms and programs.

 
Understand what test data is and describe the following types of test data:
  • normal (typical)
  • boundary (extreme)
  • erroneous data.

Boundary data would be for example:

If the allowed range is 1 to 10, then boundary data is 0, 1, 10, 11, ie either side of the allowed boundary.

Be able to select and justify the choice of suitable test data for a given problem.

 
Understand that there are different types of error:
  • syntax error
  • logic error.
 
Be able to identify and categorise errors within algorithms and programs.