1/338
Looks like no tags are added yet.
data type
defined by the values it can take and which operations can be performed on it
Integer
A whole number, positive or negative, including zero
Real / Float
A positive or negative number which can have a fractional part
Boolean
a value which is either true or false
Character
A single number, letter or symbol
string
A collection of charcaters
Data/ time
A way of storing a point in time
Pointer
A way of storing memory addresses
Records
A collection of fields each can have thier own data type
Arrays
A finite indexed set of related elements each of which has the same data type
User-defined data types
-Ensures that a solution is as memory efficient as possible
Variable declaration
Creating a variable for the first time, giving it a name and sometimes a data type
Constant declaration
The same as variable declaration, but when creating a constant
Assignment
Giving a constant or variable a value.
Iteration
Repeating an instruction.
Selection
Comparing values and choosing an action based on those values.
Subroutine
A named block of code containing a set of instructions designed to perform a frequently used operation
Definite iteration
The number of repetitions required is known before the loop starts
Indefinite iteration
The number of repetitions required is not known before the loop starts
Nested structures
Selection structures and iteration structures can be nested
One structure is placed within another
This can easily be identified by different levels of indentation in code
Indentation makes the code easier for humans to understand
Modulo
Returns the remainder of an integer division.
Constants
-A constant's value cannot change once assigned
-can be used for storing data that doesn't need to change
-makes changing a value throughout code much easier as it only needs to be updated in one place
Variables
-can change their value during the execution of a program
Length(string handling)
Returns the number of characters in a specified string.
postions
Returns the position of a specified character within a string
Substring
Given a starting position and a length, returns a portion of a string
Concatenation
Joining two or more strings together to form a new, longer string.
Random number generation
A built-in function takes a seed value and uses a series of mathematical operations to arrive at a number
Computer generated random numbers
pseudorandom - fake random
Exception Handling
Handling an exception to avoid crashing by
-Running a section of code called a catch block
system stack
restore the program back to its previous state before resuming execution.
Subroutines
A named block of code
-Containing a set of instructions designed to perform a frequently used operation -Reduces repetition of code
-Makes code more compact and easier to read
-Can be called by writing their name in a program statement
Functions
-Required to return a value
Procedures
-A type of subroutine
-not required to return a value
Parameters
Used to pass data between subroutines, specified in brackets after a subroutine call, holding info the subroutine requires to run
Arguments
The actual values passed into a subroutine by a parameter
Function
A subroutine that always returns a value and can appear in expressions or be assigned to a variable/parameter
Local Variable
Can only be accessed from within the subroutine it is declared in, exists only while its parent subroutine executes, and is more memory efficient than a global variable
Global Variable
Can be accessed from any part of a program and exists in memory for the entire duration of the program's execution
Stack Frames
Used by computers to store return addresses, parameters, and local variables for each subroutine call
Call Stack
Where stack frames are pushed when a subroutine is called and popped when it finishes executing, allowing the computer to return to the previous subroutine
Iteration vs Recursion
When a problem can be solved recursively, it can often be solved using iteration; iterative solutions are often easier to program, but recursive solutions can be more compact in code
Recursive Subroutine
A subroutine defined in terms of itself that must include a stopping condition (base case) to prevent a stack overflow
Base Case
A stopping condition in a recursion that doesn't use recursion to return a result and must eventually be met
Procedural Programming Paradigm
Formed from sequences of instructions executed in order, utilizing procedures that can be called from anywhere including recursively[cite
Local Scope
Data structure only accessible from within the structure it is declared in[cite
Global Scope
Data structure accessible from all parts of the program[cite
Structured Approach 4 Basic Structures
Assignment, Sequence, Selection, Iteration[cite
Advantages of Structured Approach
Hierarchy Charts
Graphically represent procedural program structure using rectangles for procedures connected by relationship lines[cite
Class
A blueprint for objects specifying properties (data) and methods (instructions)[cite
Instantiation
The process of creating an object from a class (an instance of that class)[cite
Encapsulation
Combining properties and methods into a single entity (object) while hiding internal details[cite
Private (-)
Properties/methods only accessible from within the object itself[cite
Public (+)
Properties/methods providing an external interface to access/modify properties safely[cite
Inheritance
Allows a class to share properties/methods of another class, described as an 'is a' relationship[cite
Polymorphism
'Many forms' - occurs when objects are processed differently depending on their class[cite
Overriding
Subclass re-implements a method with the exact same name as an inherited base class method[cite
Association
A 'has a' relationship where an associated object forms part of container object as a property[cite
Aggregation
Weak association where associated object still exists if container object is destroyed (unfilled diamond arrow)[cite
Composition
Strong association where associated object is destroyed if container object is destroyed (filled diamond arrow)[cite
3 OOP Design Principles
Encapsulate What Varies
Isolates changing requirements inside a class so future modifications are easy[cite
Favour Composition Over Inheritance
Composition provides a more flexible relationship between objects than rigid class hierarchies[cite
Interface
A collection of abstract procedures implemented by unrelated classes to share consistent structure[cite
Abstract Method
Declared with no implementation in base class; forces subclasses to define their own implementation[cite
Virtual Method
Method in base class with default implementation that can be overridden by subclasses[cite
Static Method
Belongs to the class itself rather than any instance; invoked directly on the class[cite
Class Diagram 3 Sections
Top = Class Name, Middle = Properties, Bottom = Methods[cite
Class Diagram Visibility Symbols
Class Diagram Inheritance Arrow
Unfilled arrow pointing upwards from subclass towards the base class[cite
Moral Issues
Issues concerning an individual's sense of right and wrong, often influenced by friends, family, or teachers[cite
Ethical Issues
Issues relating to society and its collective sense of what is right or wrong, such as the use and misuse of personal data[cite
Cultural Issues
Issues arising from differences in moral values between people in different geographical areas[cite
Legal Issues
Issues that relate to the law, such as the Computer Misuse Act and Data Protection Act[cite
Challenges Facing Legislators in the Digital Age
Enforcing copyright is harder with the Internet, individuals are difficult to trace online, and international services must comply with laws of multiple countries[cite
Digital Technologies Alterations to Society
Enabled massive transformations in capacities to monitor behaviour, amass/analyse personal information, and distribute/publish personal information[cite
Responsibility of Computer Scientists
Computer scientists and software engineers wield power through algorithms and code, meaning they carry a responsibility for the moral/social impacts of their work[cite
Embedding of Values
Software and algorithms inherently embed moral and cultural values[cite
Impact of Scale
Global scale of software gives individual computer scientists the potential to produce great good or cause great harm[cite
Cambridge Analytica Case Study (2017)
Raised ethical and privacy issues when personal data was collected from sources including Facebook users without their consent[cite
WannaCry Case Study (2017)
A piece of ransomware targeting Microsoft Windows with a global impact, notably affecting NHS computer systems in England and Scotland[cite
Algorithm
A sequence of steps that can be followed to complete a task and always terminate[cite
Assignment in Pseudocode
The process of giving a value to a variable or constant, represented by an arrow pointing towards the variable (e.g. counter <- 5)[cite
Sequence in Pseudocode
Instructions that follow on from one another and execute in the order they appear[cite
Selection in Pseudocode
Choosing an action based on comparing values using IF, ELSE IF, ELSE, and END IF[cite