chapter 1 Flashcards

1
Q

What is an Abstract Data Type?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Abstraction?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an algorithm?

A

An algorithm is a finite sequence of steps which once executed solve a problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a Class?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does Computable mean?

A

It means that a problem is able to be solved

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is data abstraction?

A

The process of hiding certain details and showing only essential information to the user. It deals with the level of complexity in data systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a data structure?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a data type?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Deep Equality?

A

Refers to when two objects are the same based on their contents and their structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a dictionary?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is encapsulation?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an exception?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a format operator?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a formatted string?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define a “HAS-A” relationship

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does Implementation Independence mean?

A

A design or specification that does not depend on the details of how it is implemented, allowing for flexibility in the actual implementation.

17
Q

What is Inheritance?

A

Inheritance is an OOP principle in which subclasses can take characteristics of a parent class and thus all its methods.

18
Q

What is inheritance hierarchy?

A

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

19
Q

What is an interface?

A

An interface is the set of methods given to a user so they can interact with a class

20
Q

Define an “IS-A” relationship

A

A relationship of inheritance between classes, where one class is a type of another class. It is inheritance

21
Q

What is a list?

A

An array is a sequential ordered data structure. They are heterogenous

22
Q

Define heterogenous

A

diverse in character or content, meaning if a data structure is heterogenous its contents can be of many different data types

23
Q

What is list comprehension?

A

A way to create an array in one line. They can be sequenced one within another. Syntactic sugar

24
Q

What is a method?

A

A way to interact with an object, and theyre defined inside a class. They can be overridden to change their behaviour. Its a function

25
Q

Define mutability

A

The ability for an object to change after it has been created. Immutable means it cannot.

26
Q

What is an object?

A

Everything is an object which are instances of an object(blueprints) being realised. They are being made

27
Q

What is procedural abstraction?

A

Hiding the inner workings of a function and showing the user how to interact with it.

28
Q

What is the keyword self?

A

A reference to the instance of the class. It is used to access variables that belongs to the class.

29
Q

What is shallow equality?

A

A comparison between objects which state they are equal if they reference the exact same object. If they refer to the same memory location

30
Q

What is a string?

A

A sequence of characters

31
Q

What is a subclass?

A

It is the class which derives something from a parent

32
Q

What is a superclass?

A

It is a class in which subclasses derive properties and methods from it

33
Q

What is a truth table?

A

A mathematical table used in logic to determine the output of a compound boolean expression for every possible combination of input values.