Theory aspects Flashcards
What does an identifier table contain ?
- It contains a list of variable names
- Their data types
- Descriptions of what they are used for
What is abstraction ?
Abstraction is the process of filtering out any information which isn’t relevant to the solution and only focusing on information which is essential to the solution.
What are the benefits of abstraction ?
- It makes the solution easier to design/implement/solve
- So the solution can be designed/implemented faster
- The system is tailored to the need of the user
What is a run-time error ?
When an invalid operation is performed like dividing by zero, entering an infinite loop or stopping unexpectedly
What is decomposition ?
It is the process of breaking down a complex problem into smaller parts till each sub-task can be implemented as a program module. This makes the program easier to understand and solve.
What are the benefits of decomposition ?
- It makes the problem easier to understand and solve
- It makes the program easier to program/test and debug
- It makes the time taken to produce the code decrease since the sub-tasks can be given to different teams so the problem can be solved module by module separately.
- It helps identify program modules, sub-routines and repeated elements.
What is step-wise refinement ?
Also called the Top-Down Design, it is the process of breaking down a task to a level of sufficient detail. By splitting the large task into smaller sub-tasks which can be implemented as program modules, the level of detail of the design is increased and so the individual tasks are easier to solve and the code is produced.
What are the benefits of step-wise refinement ?
- It makes the program easier to understand and solve
- It makes the program more manageable
- The time taken to produce the code reduces
What is an algorithm ?
It is a solution to a problem expressed as a sequence of defined steps
What are the four basic constructs ?
- Sequence
- Selection
- Iteration
- Assignment
What is sequence ?
It is the execution of instructions in a fixed order.
What is selection ?
It is testing a condition to determine the sequence of execution.
How does an efficient bubble sort algorithm help ?
It reduces the number of unnecessary comparisons between elements.
- It achieves this by reducing the number of items to be checked by one after each pass
- It uses a flag variable to stop the outer loop when no more swaps are made on a single pass of the inner loop
- It resets the flag before the inner loop starts and sets it whenever a swap is performed
What is iteration ?
It is when a group of statements is executed repeatedly based on a condition.
What is assignment ?
It is when a value is given to a variable
What are the three main stages of an algorithm
- Input
- Process
- Output
What is the purpose of a record ?
It can store a set of related data of different data types under one identifier.
It makes it easier to read and understand the code
It makes it easier to access and extract an element
What are the advantages of using records ?
Why is a file needed ?
- So that the data can be permanently stored
- The data is saved after the program is run so even when the computer is switched off the data is still stored
- So the data can be accessed next time the program is run
Why should an array be used to store data ?
- All the data can be stored under a single identifier so less declaration statements are needed
- It is easier to understand/maintain/modify the data
- It makes the program easier to test/debug
- It is easier to access the individual elements
- It is easier to search and sort the data as you can iterate through it