0% found this document useful (0 votes)
7 views5 pages

Exam-Style Practice Section 2

Uploaded by

Ritu Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Exam-Style Practice Section 2

Uploaded by

Ritu Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

A Level Exam-Style Practice

1 The following are two examples of constructs that could be part of the compilation of source code by the
front-end analysis stage used by a compiler.
a = b * (c + d))
id1 assign id2 op1 left par id3 op2 id4 rightpar rightpar
a State what the first construct is an example of. [1]
b State the analysis stage for which this would be taken as input. [1]
c This analysis stage would identify individual components of this construct.
Identify the name used to define these components. [1]
d The second construct has been derived from the first construct.
Identify the name given to the individual components of this construct. [1]
e Identify the stage that would take the second construct as input. [1]
f Identify and describe the table that would be created during the first analysis stage
of the compilation. [3]
g Identify the last analysis stage of the compilation process. [1]
h Explain what this last stage of analysis involves. [2]
i Identify what is produced from the last stage of the front-end analysis stage as input for the
back-end synthesis stage of the compilation. [1]
j For the particular example, give a reason that will prevent the compiler from moving on to the
back-end synthesis stage? [1]
2 a A graph can be used in an artificial intelligence application.
i Identify the two components of a graph. [2]
ii One of these components will carry a label. State which component carries a label. [1]
iii Give two examples of what the label could represent. [2]
iv Dijkstra’s and A* are two examples of a graph-based algorithm.
Describe the difference between these two algorithms. [3]
b i Define the following three terms:
Machine learning
Artificial neural network
Deep learning [6]
ii State two relationships that exist between any two of these three. [2]
3 The TCP/IP protocol suite can be represented as a protocol stack.
a Draw a diagram to represent the TCP/IP protocol stack with labelled boxes. [4]
b Give four reasons as to why the TCP/IP protocol suite is represented as a stack of layers. [4]

© Cambridge University Press 2019


c Explain why the TCP/IP protocol suite by itself does not represent a model for the
communication between two end-systems using the Internet. [2]
d Describe how packet switching is handled by the TCP/IP protocol suite when packets
are being sent. [4]
4 A given processor instruction set supports the following modes of addressing:
immediate, direct, indirect and indexed.
Figure 1 shows the contents of a part of memory and the index register IX.
Figure 1
Address Memory
IX 100
2 101
102 105
103 106
104 103
105 102
106 104
107
108
109
110

Complete the fourth column of Table 1 to show the contents of the accumulator ACC after the
operation in that row has been executed. [4]
Table 1
Opcode Operand Explanation ACC
LDM #104 Load ACC using immediate
addressing
LDD 102 Load ACC using direct addressing
LDI 104 Load ACC using indirect addressing
LDX 102 Load ACC using indexed addressing

5 A binary tree is implemented using an array of records. Each record stores a string field Data and two
pointer fields, Left and Right.

© Cambridge University Press 2019


Table 2
Tree
Index Left Data Right
0 2 Jo 1
1 4 Paula 3
2 5 Charlie 6
3 −1 Vivienne −1
4 −1 Matt −1
5 −1 Anna −1
6 −1 Dave −1

a Using the information in Table 2, complete the diagram of the binary tree.

[4]
b The following procedure outputs each data item in turn:
01 PROCEDURE Traverse(Tree, Ptr)
02 IF Tree[Ptr].Left > -1
03 THEN Traverse(Tree, Tree[Ptr].Left)
04 END IF
05 OUTPUT Tree[Ptr].Data
06 IF Tree[Ptr].Right > -1
07 THEN Travers(Tree, Tree[Ptr].Right)
08 END IF
09 END PROCEDURE
i Explain how you can tell that the Procedure Traverse is recursive. [2]
ii Complete the trace table below for the call Traverse(Tree, 0).
Give the statement number being executed in each row.
The first four rows have been completed for you. [12]

© Cambridge University Press 2019


Call Ptr Statement Tree[Ptr].Left OUTPUT Tree[Ptr].Right comment

1 0 01

02 2

03

2 2 01

© Cambridge University Press 2019


6 a In the context of object-oriented programming, define the following terms:
i Class
ii Object
iii Method
iv Encapsulation
v Getter
vi Setter
vii Property [7]
b A software house employs systems analysts and programmers. The software house also contracts
external testers and document writers. When a new project is started, the software house creates
a project team, consisting of a systems analyst, several programmers, a tester, and a document
writer. The personnel department requires a program to manage these teams. Three main classes
have been identified: Employee, Contractor, ProjectTeam.
Using inheritance and containment (aggregation) as appropriate, describe a suitable design. [7]

© Cambridge University Press 2019

You might also like