chapter 1 Flashcards
What is an Abstract Data Type?
A data type in which you do not know how it works under the hood but you can interact with its interface and you know its methods. E.g. You don’t know how an array works but you know how to access an element
What is Abstraction?
Abstraction is the process of hiding the inner workings of something so that the user is left with a succinct and high level overview of the item. Only necessary features shown
What is an algorithm?
An algorithm is a finite sequence of steps which once executed solve a problem
What is a Class?
A class is a representation(blueprint) of an object(a particular data structure) which contains ways to interact with it(methods). It contains a constructor which initialises the object which can take parameters. The initial parameters are called attributes.
What does Computable mean?
It means that a problem is able to be solved
What is data abstraction?
The process of hiding certain details and showing only essential information to the user. It deals with the level of complexity in data systems.
What is a data structure?
A data structure is a form of an Abstract Data Type in which the user is presented with a high level view of a way in which data can be stored, with various ways(methods) to interact with it. It is a way of organising data efficiently
What is a data type?
A data type, also called an atomic data type, is binary code translated in a way that the user can understand what it is. There are many different types such as integers, characters, floats etc which also distinguish what operations can be performed on the data.
What is Deep Equality?
Refers to when two objects are the same based on their contents and their structure
What is a dictionary?
Also called a hash table, it is a data structure in which values have a corresponding key which are used to access the value. They are non sequential and unordered.
What is encapsulation?
Also called information hiding it is the bundling of data with the methods that operate on that data. It restricts direct access to some of an object’s components, which is a means of preventing accidental interference and misuse of the methods and data.
What is an exception?
Also called a logic error, it is raised when there is a problem in the programs code generated by the user which will halt the execution of a program. Can be raised purposefully by a user
What is a format operator?
A special operator (often % in many languages) used to format strings with variables or expressions.
print(“%s is %d years old.” % (aName, age))
the small characters correspond to a specific data type e.g. d == integer
What is a formatted string?
A formatted string is a template in which words or spaces that will remain constant are combined with placeholders for variables that will be inserted into the string
e.g. f strings in python
Define a “HAS-A” relationship
A relationship between objects in which one object is a part of another. One object contains another, possibly in its constructor or by another class instant being a parameter of another class
What does Implementation Independence mean?
A design or specification that does not depend on the details of how it is implemented, allowing for flexibility in the actual implementation.
What is Inheritance?
Inheritance is an OOP principle in which subclasses can take characteristics of a parent class and thus all its methods.
What is inheritance hierarchy?
This is the order in which subclasses derive properties and methods from its parent classes, thereby creating a tree like structure. Classes at the bottom will have properties of every class above it aswell its own. These all must be explicitly defined in the constructor before any attributes are initialised
What is an interface?
An interface is the set of methods given to a user so they can interact with a class
Define an “IS-A” relationship
A relationship of inheritance between classes, where one class is a type of another class. It is inheritance
What is a list?
An array is a sequential ordered data structure. They are heterogenous
Define heterogenous
diverse in character or content, meaning if a data structure is heterogenous its contents can be of many different data types
What is list comprehension?
A way to create an array in one line. They can be sequenced one within another. Syntactic sugar
What is a method?
A way to interact with an object, and theyre defined inside a class. They can be overridden to change their behaviour. Its a function
Define mutability
The ability for an object to change after it has been created. Immutable means it cannot.
What is an object?
Everything is an object which are instances of an object(blueprints) being realised. They are being made
What is procedural abstraction?
Hiding the inner workings of a function and showing the user how to interact with it.
What is the keyword self?
A reference to the instance of the class. It is used to access variables that belongs to the class.
What is shallow equality?
A comparison between objects which state they are equal if they reference the exact same object. If they refer to the same memory location
What is a string?
A sequence of characters
What is a subclass?
It is the class which derives something from a parent
What is a superclass?
It is a class in which subclasses derive properties and methods from it
What is a truth table?
A mathematical table used in logic to determine the output of a compound boolean expression for every possible combination of input values.