1/60
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Integer
whole numbers
Real/Float
Decimal numbers
Boolean
True or False (1 or 0)
Character
A single symbol
String
A sequence of characters
Date/Time
Stores date and time values
Point/Refrence
Holds memory address of a variable
Record
A structured data type, similar to a dictionary
Array
A collection of elements of the same type
List
An array that can be comprised of multiple data types
Arrays vs Lists vs Tuples
Lists are dynamic, mutable with multiple data types
Arrays are fixed, mutable with a single data type
Tuples are fixed, immutable and hold a single data type
Variable Declaration
Declaring the name of a variable
Constant Declaration
Declaring the name of a constant
Assignment
Assigning a value to a variable or constant
Iteration
Repeats a block of code multiple times
Definite Iteration
Iterates for a certain number of values (i.e. for loop)
Indefinite Iteration
Iterates for an unknown number of times (i.e. while loop)
Subroutine
Block of reusable code available when called
Nested Structure
A programming structure where one structure is contained within another
Truncation
Removes the decimal part of a number without rounding
Ceiling
rounds a number up to the nearest integer
Floor
rounds a number down to the nearest integer
Local Variables
Declared inside a function, exist only within the function, cannot be accessed from outside
Advantages of Local Variables
Saves memory as created and destroyed when needed, prevents unintended modification
Global Variable
Declared outside all functions, accessible throughout the program
Disadvantages of Global Variables
makes debugging harder, can accidentally override values, functions become less reusable
A Stack Frame consists of
Return Address, Contents of Registers, parameters to be passed, local variables
Base Case (Recursive Techniques)
The condition which stops recursion
Recursive Case
The function calls itself
Recursion
Where a function calls itself to solve a problem by breaking it down into smaller, more manageable parts
Advantages of Recursion
simplifies problem, more elegant and easier to read
Disadvantages of Recursion
High memory usage, can lead to stack overflow, iterative solutions often more efficient
Programming Paradigms
Ways to classify programming based on their methodology, including object-oriented, functional, and procedural.
Procedural-Oriented Programming
Uses sequential execution, selection, and iteration to control flow of program.
Advantages of Procedural Programming
easy to debug and modify, easy to write and understand, reusable functions improve efficiency, good for tasks that have a clear sequence of operations
Disadvantage of Procedural Programming
harder to maintain for large-scale projects, code reusability is limited compared to OOP
Object-Oriented Programming (OOP)
Organises code around data or objects, rather than functions and logic.
Class (OOP)
A blueprint for creating objects, containing attributes and methods.
Attribute (OOP)
Properties of a class (values)
Method (OOP)
Subroutines inside a class that can be called
Object (OOP)
An instance of a class allocated in memory
Instantiate (OOP)
To create an instance of an object, stored inside a variable
Inherit (OOP)
To build a relationship between similar classes.
Parent (OOP)
A super class of a child.
Chid (OOP)
A sub class of a parent - inherits the same attributes and methods
Encapsulation (OOP)
Bundling of data into a class with the methods that operation on that data, using getters and setters. Hides values within the class to protect them from outside interference.
Private (OOP)
Components that can only be seen and changed in the class
Protected (OOP)
Components that can only be seen and changed in the class, or subclasses of that.
Public (OOP)
Components that can be seen and changed anywhere in the code
Polymorphism (OOP)
Enables objects of different classes to be treated as objects of a common superclass, allowing methods to perform differently based on the object's actual class.
Overriding (OOP)
When a subclass provides as specific implementation of a method that is already defined in the parent class, replacing the base functionality.
Association (OOP)
A general relationship between classes that doesn’t imply ownership.
Aggregation (OOP)
A type of relationship between two classes where one has a reference but can exist independently.
Composition (OOP)
A stronger form of association where the class cannot exist without another (Death Relationship)
Abstract Method (OOP)
A method defined in an abstract class that has no implementation.
Virtual Method (OOP)
A method in a base class that is intended to be overridden in child classes.
Static Method (OOP)
A method that belongs to the class itself, rather than any instance of a class. Static methods can be called without creating an instance.
Interface (OOP)
A skeleton or outline of a class where methods are defined but not implemented.
Composition in Class Diagrams
black diamond
Aggregation in Class Diagrams
white diamond
Public, Private, Protected - Class Diagrams
+, -, #