Paper 1 Flashcards
What are some advantages of subroutines?
- Individual models can be written and tested independently, speeding up development process
- modules can be reused
- large programs can be split up into smaller modules that are easier to read, debug and maintain
Define representational abstraction
Abstraction of a problem arrived at by removing any unnecessary details
Define abstraction by generalisation
A grouping by common characteristics to arrive at a hierarchical relationship of the “is a kind type”
Define procedural abstraction
Using a procedure to carry out a sequence of steps for achieving some task.
What is functional abstraction?
Further abstracting a procedure, removing all details of the implementation of the procedure, resulting in just a function
What is data abstraction?
Knowledge of details of how data are actually represented are hidden, allowing new kinds of data objects to be constructed from previously defined types of data objects.
Define information hiding
Hiding all details of an object that do not contribute to its essential characteristics
Define decomposition
Breaking down larger problems into smaller, identifiable problems
Define composition
Putting together smaller tasks to make larger, compound problems
Define automation
Putting models (abstraction of real world objects/phenomena) into action to solve problems. This is achieved by:
creating algorithms
implementing the algorithms in program code
What is an ADT?
An abstract data type is a logical model of how data is represented and the operations performed on it
What is a queue?
A queue is a FIFO data structure. Items are added to the back and removed from the front
Differences between dynamic and static data structure
- Memory allocated dynamically by aid of heap to dynamic data structures, whereas static data structures cannot change in memory as memory needs to be decided on creation of data structure
- dynamic data structures may require use of pointer variables
How to add an element to a circular queue?
SUB queue(newitem)
if isFull():
OUTPUT(“Queue is full”)
else:
rear = (rear + 1) MOD maxSize
queue[rear] = newItem
how to dequeue from a queue?
SUB dequeue
if isEmpty():
OUTPUT(“queue is empty”)
else:
item = queue[front]
front = (front + 1) MOD maxSize
size = size - 1
return item
What is a dictionary?
ADT consisting of associated pairs of items