Mock Revision Flashcards

1
Q

What is abstraction?

A

Abstraction is the process of removing excessive details to arrive at a
representation of a problem that consists of only the key features.

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

What is representational abstraction?

A

Analysing what is relevant to a given scenario and simplifying a problem based on this information.

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

What is abstraction by generalisation?

A

Categorising certain problems as being of a particular type, then using common solutions to solve them.

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

What is data abstraction?

A

When details about how data is stored are hidden, so programmers can make use of abstract data structures without knowing how they are implemented.

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

What is procedural abstraction?

A

When programmers can perform functions without having any knowledge about the code used to implement the functionality.

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

What do very large, complex problems use?

A

They use multiple levels of abstraction, with each level performing a different role. The highest levels are closest to the user and provide an interface to interact with, and the lowest levels are responsible for performing these tasks through the execution of machine code.

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

Why is abstraction good in a system?

A

It allows non-experts to make use of it by hiding information that is too complex or irrelevant to it’s purpose.

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

Why is abstraction good in software?

A

It enables more efficient design, as programmers don’t have to worry about unnecessary details. This reduces the time needing to be spent on the project and prevents the program getting unnecessarily large.

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

What is caching?

A

Caching is the process of storing instructions or values in cache memory after usage, as they may be used again. This saves time which would have otherwise needed to be used to store and retrieve the instructions from secondary storage again.

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

What is prefetching?

A

A more advanced version of caching, in which algorithms predict which instructions will soon be fetched. These are then loaded and stored in cache before being fetched, meaning less time is spent waiting for them to be loaded from the hard disk.

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

What is the limitation to prefetching?

A

The accuracy of the algorithms used, as they can only provide an informed prediction as to which instructions will be used, not a guarantee.

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

What is the limitation to caching?

A

How well a caching algorithm is able to manage the cache. Larger caches take a long time to search, so cache size limits how much data can be stored.

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

Give 3 examples of reusable components.

A

Implementations of abstract data structures, classes and subroutines.

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

Why are reusable components good?

A

More reliable, as they have already been tested and bugs dealt with.
This saves time, money and resources.
It also means they can be reused in future projects, saving further costs.

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

Why can reusable components be bad?

A

It may not always be possible to integrate existing components by third parties, because of compatibility issues with the rest of the software.
This means that the components need to be modified to work with the rest of the software, which can sometimes be more time-consuming than developing them in house.

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

What is problem decomposition?

A

Continually breaking down a large, complex problem into smaller subproblems which can be solved more easily.

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

Why is problem decomposition good?

A

Problems divided into sections become more feasible to manage and can be divided by a group of people according to the individuals’ skillsets.

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

Why is problem decomposition good?

A

Problems divided into sections become more feasible to manage and can be divided by a group of people according to the individuals’ skillsets.

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

How are problems commonly decomposed?

A

Top down design, also known as stepwise refinement.
Higher levels provide an overview, while lower levels specify in detail the components.

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

What is the aim of using top down design?

A

To keep splitting problems into subproblems until each problem can be represented as a self-contained module/subroutine. This can then be developed and tested separately before being integrated together.

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

Key part of identifying the components of a solution

A

Identifying tasks which could be solved using an already existing module, subroutine or library.

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

What are two of the most important decisions made within software development?

A

What programming paradigm to use, and how different pieces of information are collected.

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

What does sequence mean?

A

Code is executed line-by-line, from top to bottom

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

What does branching mean?

A

A certain code block is run if a specific condition is met, using IF statements. Also known as selection.

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

What does iteration mean?

A

A block of code is executed a certain number of times or while a condition is met. Using for, while or repeat until loops.

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

What is count controlled iteration?

A

Iteration is repeated a given number of times

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

What is condition controlled iteration?

A

Iteration continues until a given condition is met.

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

What is recursion?

A

A programming construct in which a subroutine calls itself during its execution, until a stopping condition is met, when the recursion stops. Produces same result as iteration.

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

What is the advantage of using recursion for certain problems?

A

They can be represented in fewer lines of code, making them less error-prone.

29
Q

How does recursion work?

A

When the function calls itself, a new stack frame is create within the call stack, where parameters, local variables and return addresses are stored. This allows the subroutine to return to that point during its execution. Keeps going till the base case is reached, when the subroutine unwinds and pops the information off the stack.

30
Q

What are two disadvantages to recursion?

A

Inefficient use of memory - if it calls itself too many times, danger of a stack overflow, when a call stack runs out of memory causing a crash.
Also difficult to trace, with more and more function calls.

31
Q

What is tail recursion.

A

A form of recursion which is implemented in a more efficient way, in which less stack space is required.

32
Q

What does scope refer to?

A

The section of code in which a variable is available.

33
Q

What is the scope of a local variable?

A

Limited, meaning they can only be accessed within the block of code in which they were defined. If defined within a subroutine, can only be accessed within that subroutine.

34
Q

Why are local variables good?

A

Multiple local variables with the same name can exist in different subroutines and remain unaffected by each other. Ensures subroutines are self-contained, with no danger of variables affected by code outside the subroutine.

35
Q

What is the scope of a global variable?

A

Accessible across the whole program. All variables in the main body of a program are declared to be this, so useful for values that need to be used my multiple program parts.

36
Q

Why is using global variables not recommended?

A

They can be unintentionally overwritten and edited.
They require more memory, because they aren’t deleted till the program terminates.

37
Q

What happens if a local variable exists within a subroutine with the same name as a global variable?

A

The local variable will take precedence.

38
Q

What is modular programming?

A

Talk about decomposition.

39
Q

Compare procedures and functions?

A

Both named blocks of code that perform a specific tasks. Procedures don’t have to return a value, but can return multiple. Functions return one single value. Procedures typically given data as parameters while functions make use of local variables.

40
Q

What does passing by value mean?

A

A parameter is treated as a local variable: a copy is passed to the subroutine and discarded at the end, so its value outside of the subroutine won’t be affected.

41
Q

What does passing by reference mean?

A

The address of the parameter is given to the subroutine, so the value will be updated at the given address.

42
Q

What is an IDE?

A

A program which provides a set of tools to make it easier for programmers to write, develop and debug code.

43
Q

5 features of an IDE

A

Stepping
Variable watch
Breakpoint
Source Code Editor
Debugging Tools

44
Q

What is stepping (IDE)

A

Monitoring the effect of each individual line of code by executing a single line at a time

45
Q

What is variable watch (IDE)

A

Used to pinpoint errors, lets you observe how the contents of a variable change in real time through the execution of a program.

46
Q

What is a breakpoint(IDE)?

A

IDEs let users set a point in the program where it will stop, based on a condition or set at a specific line. Helps pinpoint errors.

47
Q

What is a source code editor(IDE)?

A

Makes the coding process easier by providing features like word autocompletion, indentation, syntax highlighting and bracket completion.

48
Q

What are debugging tools(IDE)?

A

Some provide run time detection of errors, with a guide as to where they have occurred through highlights and line numbers.

49
Q

What is a class?

A

A template for an object defining it’s state and behaviour.

50
Q

What is an object’s state?

A

Attributes defining it’s properties

51
Q

What is an object’s behaviour?

A

Methods describing the actions it can perform.

52
Q

What is an object?

A

A particular instance of a class

53
Q

What is encapsulation?

A

In OOP, attributes are declared as private so can only be altered by public methods.

54
Q

Why is encapsulation used?

A

To implement the principle of information hiding, protecting data from being accidentally edited by other parts of the program.

55
Q

How does top down design implement encapsulation?

A

Each module is designed to be self contained.

56
Q

What does performance modelling do?

A

Eliminates the need for performance testing by providing mathematical models to test a variety of loads on different operating systems.

57
Q

Why is performance modelling useful?

A

It provides a cheaper, less time-consuming or safer method of testing applications, useful for safety critical computer systems where it isn’t safe to do a real trial run before the system is implemented.

58
Q

What is visualisation?

A

Representing data in a way that is easier for us to understand.

59
Q

Why is visualisation good?

A

It allows us to identify otherwise non-obvious trends, particularly among statistical data.

60
Q

How are stacks implemented?

A

As an array which use a single pointer, to keep track of the top of the stack

61
Q

How are queues implemented?

A

Also as arrays, but making use of two pointers, a front and a back. Front holds the position of the first element and back the next available space.

62
Q

What is a linked list?

A

A list composed of nodes, each of which has a pointer going to the next item in the list and a value. Searching is performed by using a linear search through the pointers.

63
Q

Depth first (post-order) traversal

A

Go deepest first, order you pass by on the right.

64
Q

What are trees made of?

A

Nodes and edges, which can’t contain cycles and aren’t directed.

65
Q

Breadth first

A

Visit all children from left to right, then go down a layer.

66
Q

What is the difference between Dijkstra’s and A*

A

A* has two cost functions, the first being the actual cost (same as in Dijkstra’s), and second being an approximate cost from node x to the final node called a heuristic, which aims to make the shortest path finding process more efficient.

67
Q

How to use string handling (pseudocode)

A

stringname.subString(startingPosition, numberofCaracters)

68
Q

Reading from a file

A

myFile = openRead(“filename)
x = myFile.readLine()
or myFile.writeLine(“hello world”)
myFile.close()

myFile.endofFile determines end of file

69
Q

Example of instantiation class pet

A

class Pet
private name
public procedure new(givenName)
name=givenName
endprocedure

70
Q

Example of Dog inheriting from pet with added thing, breed.

A

class Dog inherits Pet
private breed
public procedure new(givenName, givenBreed)
super.new(givenName)
breed=givenBreed
endprocedure
endclass

71
Q

Instance of a new class

A

name = new classname(parameters)