AQA A-Level Computer Science Paper 1 (Python)

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/232

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

233 Terms

1
New cards

Data Type

An attribute of data that determines how the compiler will use the data in a program.

2
New cards

Language-Defined Data Types

A primitive data type provided by a programming language.

3
New cards

User-Defined Data Types

Custom data types designed by the user by combining existing data types for the bespoke needs of their system.

4
New cards

Non-Composite User-Defined Data Types

User-defined data types that contain only one data type.

5
New cards

Non-Composite User-Defined Data Types Examples

Enumerators — binds a group of names to constant values (e.g. January = 1 etc.).

Pointers — refers to a location in memory.

6
New cards

Composite User-Defined Data Types

User defined types that contain more than one data type.

7
New cards

Composite User-Defined Data Types Example

Records — references other datatypes, similar to how an OOP object has attributes of different data types.

Sets — unordered, iterable, mutable, and contain no duplicate data types.

8
New cards

Variable

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

9
New cards

Constant

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

10
New cards

List

A collection of elements with an inherent order

11
New cards

Random.randint(1,3)

Determines a random integer from 1 to 3.

12
New cards

Random.choice([“1”, “2”, “3”])

Determines a random item in a list.

13
New cards

Random.random()

Determines a random float from 0 to 1.

14
New cards

Random.uniform(1,3)

Determines a random float from 1 to 3.

15
New cards

Modular Programming

The breaking down of a major task into smaller subtasks.

16
New cards

Subroutine

A set of instructions with a callable name.

17
New cards

Function

A subroutine which always returns a value when called.

18
New cards

Procedure

A subroutine which may return a value when called.

19
New cards

Subroutine Advantages

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

20
New cards

Parameters

Data passed into subroutines.

21
New cards

Recursion

A subroutine which calls itself.

22
New cards

Base Case

A value that has a solution which does not involve any reference to the general case solution. (A condition which stops recursion)

23
New cards

Local Variables

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

24
New cards

Local Variables Advantages

Keeps the subroutine self-contained.

25
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.

26
New cards

Global Variables

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

27
New cards

Built-in Functions

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

28
New cards

Procedural-Oriented Programming

A programming model which is divided into procedures.

29
New cards

Procedural-Orientated Programming Advantages

Easier to debug, reduced repeated code, subroutines can be saved into libraries.

30
New cards

Procedural-Orientated Programming Disadvantages

Focus is on completion , not integrity.

31
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.

32
New cards

Attributes

A property or characteristic of an object (OOP).

33
New cards

Methods

OOP subroutines that define the actions of the object.

34
New cards

Class

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

35
New cards

Object

An instance of a class.

36
New cards

Constructor

Constructs the attributes of the class automatically without being called.

37
New cards

Self

Reference to the bound object.

38
New cards

Instantiation

An object is defined based on a class.

39
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.

40
New cards

Inheritance

The relationship between two object types in which one ‘is a kind of’ the other and shares some of its properties or behaviours.

41
New cards

Super-classes

A class from which another class can inherit from.

42
New cards

Sub-class

A class which inherits from another class.

43
New cards

Super Constructor

Sets up the parent class inside the child class.

44
New cards

Association

The relationship between two classes, categorised into either composition or aggregation.

45
New cards

Composition

A type of association where the composite object has ownership of the objects within it. The objects that are part of the composite objects have a lifecycle determined by the composite object. If the composite object ceases to exist then they too will cease to exist.

46
New cards

Aggregation

A type of association where the aggregated object has weaker form of association with the objects that it is aggregating that is the case with composition. These objects have an existence independent of the aggregated object and can continue to exist even after the aggregated object is disposed of.

47
New cards

Encapsulation

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

48
New cards

Public Attributes and Methods (+)

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

49
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.

50
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.

51
New cards

Getters

Methods that ‘get’ a private attribute value.

52
New cards

Setters

Methods that ‘set’ the private attribute value.

53
New cards

Polymorphism

Giving an action one name that is shared up and down a class hierarchy. Each class in the hierarchy implements the action in a way appropriate to itself.

54
New cards

Overriding Polymorphism

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

55
New cards

Overloading Polymorphism

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

56
New cards

Object Storage

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

57
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.

58
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.

59
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.

60
New cards

Virtual Method

Implementation can be redefined by subclasses.

61
New cards

OOP First Principle — Encapsulate What Varies

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

62
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.

63
New cards

OOP Third Principle — Program to Interfaces, not Implementation

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

64
New cards

Elementary Data Type

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

65
New cards

Composite Data Type

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

66
New cards

Abstract Data Type

A data type whose properties are specified independently of any particular programming language.

67
New cards

Queue

A FIFO abstract data type

68
New cards

Linear Queue

Elements join the queue at one end and leave the queue at the other.

69
New cards

Queue Operations

Enqueue, dequeue, isempty, isfull

70
New cards

Circular Queue

When the array element with the largest possible index has been used, the next element to join the queue reuses the vacated location at the beginning of the array.

71
New cards

Priority Queue

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

72
New cards

Dynamic Data Structures

Allocates and deallocates memory from heap, avoiding overflow errors.

73
New cards

Heap

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

74
New cards

Static Data Structures

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

75
New cards

Stack

A LIFO abstract data type.

76
New cards

Stack Operations

Push, pop, peek, isfull, isempty

77
New cards

Call Stack

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

78
New cards

Stack Frame

The locations in the stack area used to store the values referring to one invocation of a routine.

79
New cards

Graph

An abstract data structure that represents complex relationships.

80
New cards

Directed Graph (Digraph)

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

81
New cards

Undirected Graph

A graph where all edges are non-directional.

82
New cards

Weighted Graph

A graph where edges have a cost of traversal.

83
New cards

Unweighted Graph

A graph where edges have no cost of traversal.

84
New cards

Simple Graph

A graph without multiple edges in which each edge connects to two different vertices.

85
New cards

Cycle

A closed path in which all edges are different and all the immediate nodes are different.

86
New cards

Degree of a Node

The number of neighbours for a specific node.

87
New cards

Adjacency Matrix

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

88
New cards

Adjacency Matrix Advantages

Convenient to work with, adding edges is simple.

89
New cards

Adjacency Matrix Disadvantages

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

90
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.

91
New cards

Adjacency List

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

92
New cards

Adjacency List Advantages

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

93
New cards

Adjacency List Disadvantages

Hard to change edges.

94
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.

95
New cards

Page Rank Algorithm

Google uses a directed graph of web pages.

96
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.

97
New cards

Depth-First Uses

Navigating a maze.

98
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.

99
New cards

Breadth-first Uses

Shortest path for an unweighted graph.

100
New cards

Heuristic

An approach that uses experience to make informed guesses that assist in finding a polynomial time solution to an intractable algorithmic problem.