AQA A-Level Computer Science Paper 1 (Python)

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/178

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

179 Terms

1
New cards

Variable

A memory location that can be used to store data which can be updated while the code is running.

2
New cards

Constant

A memory location that can be used to store data which cannot be updated whilst the code is running.

3
New cards

Modular Programming

The breaking down of a major task into smaller subtasks.

4
New cards

Subroutine

A set of instructions with a callable name.

5
New cards

Function

A subroutine which always returns a value when called.

6
New cards

Procedure

A subroutine which may return a value when called.

7
New cards

Subroutine Advantages

Avoids repeating code, enables sub-testing, enables top-down development, allows for modular programming.

8
New cards

Parameters

Data passed into subroutines.

9
New cards

Recursion

A subroutine which calls itself.

10
New cards

Base Case

A condition that stops recursion.

11
New cards

Local Variables

Variables within a single subroutine that can only be used in that subroutine.

12
New cards

Local Variables Advantages

Keeps the subroutine self-contained.

13
New cards

Local Variable Disadvantages

Only exists whilst the subroutine is executing, only accessible within the subroutine, local and global variables with the same name can be misidentified.

14
New cards

Global Variables

Defined in the main program and can be used in any subroutine called from the main program.

15
New cards

Built-in Functions

print(), min(), max(), sorted(), int()

16
New cards

Object-Orientated Programming

Defines separate objects that have their own associated attributes and methods that can be easily grouped together in a logical way.

17
New cards

Attributes

OOP variables that define characteristics of the object.

18
New cards

Methods

OOP subroutines that define the actions of the object.

19
New cards

Class

A set of objects which share a common data structure and common behaviour.

20
New cards

Object

An instance of a class which uses attributes and methods from the class.

21
New cards

Constructor

Constructs the attributes of the class automatically without being called.

22
New cards

Self

Reference to the bound object.

23
New cards

Instantiation

The creation of objects from a class.

24
New cards

OOP Advantages

Produces reusable code and objects, data is protected, code produced contains fewer errors, solutions are easier to understand, easier to enforce design consistency.

25
New cards

Inheritance

Classes can inherit attributes and methods from other classes.

26
New cards

Super-classes

A class from which another class can inherit from.

27
New cards

Sub-class

A class which inherits from another class.

28
New cards

Super Constructor

Sets up the parent class inside the child class.

29
New cards

Composition

If the containing object is destroyed, so are the objects it contains.

30
New cards

Aggregation

If the containing object is destroyed, the objects it contains are not destroyed.

31
New cards

Encapsulation

Grouping data and subroutines to make a program easier to understand.

32
New cards

Public Attributes and Methods (+)

Attributes and methods that can be accessed from outside of the class. All methods tend to be public.

33
New cards

Protected Attributes and Methods (_)

Attributes and methods that can be accessed within its class and by subclasses. Most attributes should at least be protected.

34
New cards

Private Attributes and Methods (__)

Attributes and methods that can only be accessed from within its class. Some attributes, especially those holding personal information, should be private.

35
New cards

Getters

Methods that ‘get’ a private attribute value.

36
New cards

Setters

Methods that ‘set’ the private attribute value.

37
New cards

Polymorphism

A method used in a class hierarchy can be used differently in each class.

38
New cards

Overriding Polymorphism

Methods that are defined with the same identifier in the superclass, but have a different implementation in a subclass.

39
New cards

Overloading Polymorphism

Allows multiple methods that require different parameters to use the same name.

40
New cards

Object Storage

Objects are stored in a dictionary, which can be accessed using the code self.__dict__

41
New cards

Class Attributes

An attribute for the whole class, not just the object. Often used to keep track of how many objects have been instantiated. Called using class.classvariable.

42
New cards

Static Method

Does not need to have self in the parameter list because it is designed to be invoked through the class and not an object.

43
New cards

Abstract Method

Consists of only a signature and no implementation used to specify that a subclass must provide an implementation of the method.

44
New cards

Virtual Method

Implementation can be redefined by subclasses.

45
New cards

OOP First Principle — Encapsulate What Varies

Data inside the object should only be accessed through an interface (the object’s methods).

46
New cards

OOP Second Principle — Favour Composition over Inheritance

Composition is less rigid than the relationship that exists in inheritance. An object might be ‘composed’ of several other objects, but it would not necessarily make sense to say that it inherited the characteristics.

47
New cards

OOP Third Principle — Program to Interfaces, not Implementation

Focus your design on what the code is doing, not how it does it.

48
New cards

Elementary Data Type

The simplest type of data, such as Boolean, char, float, or integer.

49
New cards

Composite Data Type

A data type made up of smaller forms of data, such as array or string.

50
New cards

Abstract Data Type

A logical description of how data is viewed and the possible operations done on the data.

51
New cards

Queue

A FIFO data structure.

52
New cards

Queue Operations

Enqueue, dequeue, isempty, isfull

53
New cards

Circular Queue

An algorithm that reuses the spaces that have been freed by dequeuing items from the front of the array.

54
New cards

Priority Queue

A queue that allows some items to ‘jump’ the queue is they have an associated priority.

55
New cards

Dynamic Data Structures

Allocates and deallocates memory from heap, avoiding overflow errors.

56
New cards

Heap

An area of memory especially allocated for use by dynamic data structures.

57
New cards

Static Data Structures

Cannot allocated or deallocate memory, as it is fixed in size.

58
New cards

Stack

A LIFO data structure.

59
New cards

Stack Operations

Push, pop, peek, isfull, isempty

60
New cards

Call Stack

A system level data structure that provides the mechanism for saving local variables, passing parameters, and return addresses to subroutines.

61
New cards

Graph

An abstract data structure that represents complex relationships.

62
New cards

Directed Graph (Digraph)

A graph where routes are uni-directional or bi-directional.

63
New cards

Undirected Graph

A graph where all routes are non-directional.

64
New cards

Weighted Graph

A graph where edges have a cost of traversal.

65
New cards

Unweighted Graph

A graph where edges have no cost of traversal.

66
New cards

Adjacency Matrix

A table where each row and column represents a table, and the item at [row, column] indicates a connection.

67
New cards

Adjacency Matrix Advantages

Convenient to work with, adding edges is simple.

68
New cards

Adjacency Matrix Disadvantages

A sparse graph with not many edges will leave most of the cells empty, wasting memory.

69
New cards

Adjacency Matrix Uses

When there are many edges between vertices, edges are frequently changed, or when the presence of edges needs to be tested.

70
New cards

Adjacency List

A list or dictionary of nodes, where the value is a list of adjacent nodes.

71
New cards

Adjacency List Advantages

Only uses storage for connections that exist, a good way of representing a large, sparse graph.

72
New cards

Adjacency List Disadvantages

Hard to change edges.

73
New cards

Adjacency List Uses

When there are few edges between nodes, edges are rarely changed, and the presence of edges does not need to be tested.

74
New cards

Page Rank Algorithm

Google uses a directed graph of web pages.

75
New cards

Depth-first Graph Traversal

Traversing a graph by going as far down a path as possible before backtracking and going down the next path.

76
New cards

Depth-First Uses

Navigating a maze.

77
New cards

Breadth-first Graph

Traversing a graph by going to all the adjacent nodes of the current node, and all the adjacent nodes to those.

78
New cards

Breadth-first Uses

Shortest path for an unweighted graph.

79
New cards

Dijkstra’s Shortest Path Algorithm

Utilises a breadth first search and a priority queue to determine the shortest path between two nodes.

80
New cards

Tree

A connected, undirected graph with no cycles.

81
New cards

Rooted Trees

One node is identified as a root, and every node except the root has one unique parent.

82
New cards

Node

An item of data.

83
New cards

Edge

Connects two nodes.

84
New cards

Root

A tree node that has no incoming edges.

85
New cards

Child

A node connected to a node in the level above it.

86
New cards

Parent

A node connected to a node in the level below it.

87
New cards

Subtree

A set of nodes and edges comprised of a parent and all of its descendents.

88
New cards

Leaf

A node that has no children.

89
New cards

Binary Tree

A rooted tree in which each node has a maximum of two children.

90
New cards

Pre-order Tree Traversal

Visit the root, then traverse the left sub-tree, then the right sub-tree, marking off nodes as you pass their left side.

91
New cards

Pre-order Tree Traversal Uses

Copying a tree.

92
New cards

In-order Tree Traversal

Traverse the left sub-tree, then visit the root, then traverse the right sub-tree, marking off nodes as you pass their bottom side.

93
New cards

In-order Tree Traversal Uses

Searching a binary tree, outputting the contents in ascending order.

94
New cards

Post-order Tree Traversal

Traverse the left sub-tree, then traverse the right sub-tree, then visit the root, marking off nodes as you pass their right side.

95
New cards

Post-order Tree Traversal Uses

Infix to Postfix conversions, producing a postfix expression from a tree, emptying a tree.

96
New cards

Tree Traversal Time Complexity

O(log n) — The execution time grows logarithmically with the input size, meaning it has an efficient time.

97
New cards

Infix Notation

Equations are written as they are usually.

98
New cards

Prefix Notation

Equations are written with the operators first, then the operands.

99
New cards

Postfix Notation

Operands are written first, then operators.

100
New cards

Hash Table

A data structure that uses a hashing algorithm and MOD table size to associate unique keys with values.