2 1 in A Particular Computer System, Real Numbers Are Stored Using Floating-Point Representation With
2 1 in A Particular Computer System, Real Numbers Are Stored Using Floating-Point Representation With
1 In a particular computer system, real numbers are stored using floating-point representation with:
(a) Calculate the normalised floating-point representation of +4.5 in this system. Show your
working.
Mantissa Exponent
Working ......................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [3]
(b) Calculate the normalised floating-point representation of −4.5 in this system. Show your
working.
Mantissa Exponent
Working ......................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [3]
3
(c) Calculate the denary value for the following binary floating-point number. Show your working.
Mantissa Exponent
0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 1
Working ......................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
Answer .......................................................................................................................................
[3]
(d) (i) State whether the floating-point number given in part (c) is normalised or not normalised.
....................................................................................................................................... [1]
............................................................................................................................................
....................................................................................................................................... [1]
(e) The system changes so that it now allocates eight bits to both the mantissa and the exponent.
Explain two effects this has on the numbers that can be represented.
1 .................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
2 .................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
[4]
4
2 The TCP/IP protocol suite can be viewed as a stack with four layers.
(a) Complete the stack by inserting the names of the three missing layers.
Application layer
[3]
(b) BitTorrent is a protocol used at the Application layer for the exchange of data.
....................................................................................................................................... [1]
....................................................................................................................................... [1]
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
....................................................................................................................................... [4]
5
(c) State two other protocols that are used at the Application layer for the exchange of data.
Protocol 1 ..................................................................................................................................
Example .....................................................................................................................................
....................................................................................................................................................
Protocol 2 ..................................................................................................................................
Example .....................................................................................................................................
....................................................................................................................................................
[4]
6
3 (a) Complete the Boolean expression that corresponds to the following truth table.
INPUT OUTPUT
A B C X
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
X = A . B . C ........................................................................................................................ [2]
The part to the right of the equals sign is known as the sum-of-products.
(b) (i) Complete the Karnaugh map (K-map) for the truth table given in part (a).
AB
00 01 11 10
0
C
1
[1]
(iii) Using your answer to part (b)(ii), write the simplified sum-of-products Boolean
expression.
X = ................................................................................................................................. [2]
7
The output of the lexical analysis stage forms the input to the next stage.
....................................................................................................................................... [1]
1..........................................................................................................................................
............................................................................................................................................
2..........................................................................................................................................
............................................................................................................................................
[2]
There are a number of reasons for performing optimisation. One reason is to produce code
that minimises the amount of memory used.
............................................................................................................................................... [1]
A ← B + 2 * 6
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [1]
8
X ← A + B
Y ← A + B + C
Following the syntax analysis stage, object code is generated. The equivalent code, in
assembly language, is shown below:
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [3]
9
5 Ed wants to send a message securely. Before sending the message, the software encrypts it
using a symmetric key.
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
....................................................................................................................................... [2]
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
....................................................................................................................................... [2]
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [2]
10
6 (a) Artificial Intelligence (AI) can be aided by the use of different techniques.
Technique Description
A* Algorithm
A computer program that improves its performance
at certain tasks with experience.
Graph
[4]
1 .................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
2 .................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
[4]
11
7 An ordered binary tree Abstract Data Type (ADT) has these associated operations:
• create tree
• add new item to tree
• traverse tree
A student is designing a program that will implement a binary tree ADT as a linked list of ten
nodes.
A program is to be written to implement the tree ADT. The variables and procedures to be used
are listed below:
These pseudocode declarations and this procedure can be used to create an empty tree with ten
nodes.
TYPE Node
DECLARE LeftPointer : INTEGER
DECLARE RightPointer: INTEGER
DECLARE Data : STRING
ENDTYPE
DECLARE Tree : ARRAY[0 : 9] OF Node
DECLARE FreePointer : INTEGER
DECLARE RootPointer : INTEGER
PROCEDURE CreateTree()
DECLARE Index : INTEGER
RootPointer ← -1
FreePointer ← 0
FOR Index ← 0 TO 9 // link nodes
Tree[Index].LeftPointer ← Index + 1
Tree[Index].RightPointer ← -1
NEXT
Tree[9].LeftPointer ← -1
ENDPROCEDURE
IF FreePointer ............................................................................................................
THEN
OUTPUT "No free space left"
ELSE
// add new data item to first node in the free list
NewNodePointer ← FreePointer
.............................................................................................................................
// adjust free pointer
FreePointer ← ..............................................................................................
// clear left pointer
Tree[NewNodePointer].LeftPointer ← ................................................
// is tree currently empty?
IF ......................................................................................................................
THEN // make new node the root node
..............................................................................................................
ELSE // find position where new node is to be added
Index ← RootPointer
CALL FindInsertionPoint(NewDataItem, Index, Direction)
IF Direction = "Left"
THEN // add new node on left
...........................................................................................
ELSE // add new node on right
...........................................................................................
ENDIF
ENDIF
ENDIF
ENDPROCEDURE [8]
(b) The traverse tree operation outputs the data items in alphabetical order.
This can be written as a recursive solution.
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
ENDPROCEDURE [5]
15
8 The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC).
Instruction
Explanation
Opcode Operand
LDM #n Load the denary number n to ACC
LDD <address> Load the contents of the location at the given address to ACC
STO <address> Store the contents of ACC at the given address
ADD <address> Add the contents of the given address to the ACC
INC <register> Add 1 to the contents of the register
CMP <address> Compare the contents of ACC with the contents of <address>
JPN <address> Following a compare instruction, jump to <address> if the
compare was False
END Return control to the operating system
LDM ............................................................................................................................................
....................................................................................................................................................
LDD.............................................................................................................................................
....................................................................................................................................................
[2]
(b) Using opcodes from the table, write instructions to set the value at address 509 to the contents
of address 500 added to the value 12.
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [3]
16
BLANK PAGE