p23 w2 Flashcards

1
Q

Explain why a binary representation is sometimes only an approximation to the real number it represents (3)

A

The fixed length of the storage means that you can’t store very large /
very small numbers
MP3 Binary numbers represent numbers based on powers of 2, with limited
fractional representations such as 1/2, 1/4, 1/8, 1/16, etc.
MP4 It isn’t possible to store all fractions with the level of precision provided
by this system
MP5 …the fractional part of the number is as close as possible within these
constraints.

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

Describe what is meant by composite and non‑composite data types

A

MP1 A (user defined) data type that is a collection of data that can consist
of multiple elements
MP2 …of different or the same data types
MP3 …grouped under a single identifier.
One mark per mark point – non-composite (Max 2)
MP4 It can be defined without referencing another data type.
MP5 It can be a primitive type available in a programming language, or a
user- defined type

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

Outline what is meant by the term collision in this context

A

mark per mark point (Max 2)
MP1 A collision is when the two values / data items in the key field for two
records (pass through a hashing algorithm and) result in the same
hash value
MP2 …so the location identified (by the hashing algorithm) may already be
in use // two records cannot occupy the same address

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

Explain how a collision can be dealt with when writing records to a random file.

A

MP5 Search the overflow area
MP6 …go through the following spaces in a linear fashion
MP7 …and store the data item in the first available slot.

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

Outline the reasons why an operating system may need to use virtual memory. 2

A

MP1 Virtual memory is used when RAM is running low
MP2 …such as when a computer is running many processes at once.
MP3 Virtual memory may be used for efficient use of RAM / the processor
MP4 …such as if data / programs are not immediately needed, they can be
moved from RAM to virtual memory

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

Explain the circumstances in which disk thrashing could occur 3

A

MP1 Disk thrashing is a problem that may occur when frequent transfers
between main memory and secondary memory take place // Disk
thrashing is a problem that may occur when virtual memory is being
used
MP2 As main memory fills up, more pages need to be swapped in and out
of secondary/virtual memory
MP3 This swapping leads to a very high rate of hard disk head movements
MP4 Eventually, more time is spent swapping the pages/data than
processing the data.

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

Explain how an expression stored in RPN can be evaluated. 3

A

MP1 The (RPN) expression is read from left to right, one item at a time
MP2 Each element is checked to see if it as operator or a value
MP3 Values are pushed onto a stack until an operator is found
MP4 The operator is applied to the last two values on the stack and the
result is pushed back onto the stack
MP5 This repeats until a single value remains, which is the solution

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

Justify the use of a linked list instead of an array to implement a stack 2

A

One mark for linked list and one mark for array (Max 2)
Linked list
MP1 A linked list is a dynamic data structure / not restricted in size
MP2 Has greater freedom to expand or contract by adding or removing
nodes as necessary
MP3 Allows more efficient editing using pointers (instead of moving the
data).
Array
MP4 An array is a static data structure1 generally fixed in size
MP5 When the array is full, the stack cannot be extended any further.

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

Explain how a compiler makes use of a stack when translating recursive programming code.

A

One mark per mark point (Max 1)
MP1 The compiler must produce object code to
One mark per mark point (Max 3)
MP2 …push return addresses / values of local variables onto a stack
MP3 …with each recursive call // … to set up winding
MP4 …pop return addresses / values of local variables off the stack …
MP5 …after the base case is reached // … to implement unwinding

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

Describe the features of the SIMD and MISD computer architectures.

A

MP1 Single Instruction, Multiple Data (architecture) // Performs the same
operation on multiple different data streams simultaneously.
MP2 The instructions can be performed sequentially, taking advantage of
pipelining.
MP3 Parallel computers with multiple processors.
One mark per mark point – MISD (Max 2)
MP4 Multiple Instruction, Single Data (architecture) // Performs different
operations on the same data stream.
MP5 Each processor works on the same data stream independently.
MP6 Parallel computers with multiple processors.

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

Describe, with an example, what is meant by an exception.

A

One mark for description, for example:
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions / causes the program to halt execution
One mark for example:
* Hardware failure // hard disk crash
* Programming error // trying to access out-of-bounds array element // divide
by zero error // runtime erro

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