Paper 1 is the programming paper, and students will have to use one of three programming languages: Python, C#, or Visual Basic
Algorithm
A sequence of steps that can be followed to complete a task
Pseudocode
A fairly relaxed version of program code that should be understood by any programmer
AQA has its own version of pseudocode
Flowchart symbols
Start/end
Process box
Input/output
Choice (for if statements and loops)
Abstraction
The process of removing unnecessary detail from a problem, simplifying it
Decomposition
Breaking a problem down into many sub-problems that each represent a specific task
Trace table
A table that shows how values change when an algorithm is carried out, going through every line of code
Trace tables do not correspond one-to-one with lines of code, there may be multiple lines of code in one row of the table
Linear search
A searching algorithm that compares each item in the list one by one until the target item is found or not found
Binary search
A more efficient searching algorithm that compares the middle item in the list to the target, and discards half the list that cannot contain the target
Binary search
Requires the list to be sorted
More time-efficient than linear search as the list grows larger
Bubble sort
A sorting algorithm that goes through the list in 'passes', swapping pairs of items to put the list in order
Merge sort
A more efficient sorting algorithm that works by repeatedly dividing the list in half and merging the sorted sub-lists
Data types
Integer
Real
Boolean
Character
String
Arithmetic operators
Division (/) and integer division (div)
Modulus (mod)
Relational and Boolean operators
Equal to (=)
And
Or
String handling operations
Substring
Concatenation
Variable
An identifier that holds a value that can be changed
Constant
An identifier that holds a value that cannot be changed after it is set
Why use constants
Improve readability
Easier to update in the future
Reduce risk of accidental changes
Input and output
User input is always a string, so may need to be converted to other data types for calculations
Fundamental programming constructs
Sequence
Selection (if statements)
Iteration (loops)
If statements are always checked, whereas else-if statements are only checked if previous conditions were false</b>
Mistakes in if/else-if statements include adding conditions to else, and forgetting about else-if
If it's always checked if you've got an if part this will always be checked no matter if you have several back to back
If price is greater than 30 and if price is greater than or equal to 20
Both premium and standard would be outputted because both are checked
Else ifs or e-lifts sit below an if statement
The else if is only checked if previous conditions were false
You can have several else ifs if you want to, just make sure they come after the if
Mistakes in exams are people adding conditions to else's and also forgetting about else if
Definite iteration
A set number of times the loop will repeat
Indefinite iteration
The loop will repeat until a condition is broken or met
For loop
1. Repeats a set number of times
2. Counter variable starts at a set number and goes to another set number
While loop
1. Repeats until a condition is broken
2. Asks user for password and keeps asking until they get it right
Repeat until loop
1. Repeats until a condition is met
2. Condition comes after the loop, so it always runs at least once
Array
An organised collection of items of the same data type
Indexing an array
1. Specifying a particular item within an array
2. Starts counting at 0
Iterating through an array
Using a for loop to output each item in the array
2D array
An array of arrays
Iterating through a 2D array
1. Using a nested for loop to access each item
2. First index is which array, second index is which item in that array
Nesting
Having one block of code inside another block of code