Many classes of artificial neural networks learn from data by forming a lower dimensional parametric representation, or
Question:
Many classes of artificial neural networks learn from data by forming a
lower dimensional parametric representation, or mapping, that resembles
the process of curve-fitting. Explain this idea in reference to least-squares
error minimisation or statistical regression.
(ii) Explain why increasing the complexity of a model may cause a neural
network's error in the training phase to become smaller and smaller, but
its generalisation in the validation phase to become worse and worse. How
would you expect the optimal complexity of a neural network model to
depend on the amount of data?
(b) Answer each of the following short questions:
(i) What is the approximate capacitance of nerve cell membrane, in
microFarads per cm2
, and what functional parameters of neural activity
are determined by this?
(ii) Approximately what range of voltages does a nerve cell membrane move
through during the course of generating a neural impulse, and what
determines this range?
(iii) What is the rˆole of positive feedback in nerve impulse generation?
[
(iv) From which organ does the retina develop embryologically, and to what
cells elsewhere in the body are the retinal photoreceptors most closely
related?
(v) What causes the refractory deadtime of about 1 msec after each nerve
impulse, and what is its consequence
Address all questions
4 Advanced Graphics and HCI
(a) Which usability evaluation techniques are most appropriate to the following
situations? For each, say why this is so.
(i) An expert user performing a familiar task.
(ii) An expert user designing a novel solution.
(iii) A new user using a system for the first time.
[6 marks]
(b) Sketch three screens of a prototype for an online newspaper that can be
customised to users' interests.
(i) How could a development team test the usability of this prototype cheaply
and quickly? Describe some basic procedures that could be applied during
testing.
(ii) Contrast the benefits of doing a Cognitive Walkthrough evaluation to
those of the procedure you have just described, in the context of this
system.
(iii) Give an example of one stage of the Cognitive Walkthrough process, as it
would apply to one of the screens you have sketched.
A spacecraft arrives at Mars, but its memory has been corrupted by radiation en
route. Luckily, it can receive updates one bit at a time using a predefined C function
short receive bit(void), that when called will return either 1 or 0. The stream
of bits for a value is transmitted in unsigned big-endian byte order: for example, a
16-bit value of 125 would be 0000000001111101. Assume the int type is 32 bits.
(a) Explain the meaning of the inline keyword on C function declarations, and a
potential drawback of using it. [2 marks]
(b) Using receive bit(), define a function receive int() that decodes and
returns a 32-bit value from the sequence of received bits. [4 marks]
(c) Build a more general decoding function receive using a C++ template with
two parameters that specify the number of bits to decode and a datatype for
the decoded value. Use this to write two template instantiations that decode an
8-bit value into a short and a 32-bit value into an unsigned long. [6 marks]
(d) Find and explain four instances of undefined behaviour that could result from
compiling and running the C code below with different command-line arguments.
The strcpy(dst,src) function copies a zero-terminated C string from the src
buffer to the dst buffer. The putchar(c) function outputs a character c to
the console. You can assume that the standard C header prototypes have been
included for
1. char *show_instruction(int msg) {
2. char buf[6];
3. int fuel;
4. if (msg == 1 && fuel--) {
5. strcpy(buf, "THRUST");
6. return buf;
7. } else if (msg == 2) {
8. char *msg = (char *)malloc(100);
9. strcpy(msg, "DEPLOY_PARACHUTE");
10. return msg;
11. }
12. }
13.
14. int main(int argc, char **argv) {
15. char *msg;
16. msg = show_instruction(argc);
17. putchar(msg[0]);
18. return 0;
19. }
This question assumes familiarity with the process language SPL and its eventbased semantics. In the following SPL process, Auth, agents can behave as initiator
or responder in parallel with an attacker Spy. Letting A and B range over agent
names, define
Init(A, B) ≡ out new x {x, A}P ub(B)
. in{x}P ub(A)
. nil
Resp(B) ≡ in{x, X}P ub(B)
. out {x}P ub(X)
. nil
Auth ≡ ki∈{init,resp,spy} Pi
where
Pinit ≡ kA,B Init(A, B), Presp ≡ kA!Resp(A), and Pspy ≡ !Spy
(a) Explain briefly and informally the behaviour of Init(A, B) and Resp(B), for
agent names A and B. Describe diagrammatically the reachable events of
Init(A, B) and Resp(B), taking care to specify the pre- and postconditions,
and actions of the events. [5 marks]
(b) Write down an SPL process for the attacker Spy; the process should be able
to compose, decompose, encrypt under public keys, and decrypt with leaked
private keys. Draw the reachable events of Spy. [5 marks]
Assume a sequence of event-transitions
hAuth, s0, t0i
e1
→ · · · h
pr−1, sr−1, tr−1i
er
→ h
pr, sr, tri · · ·
from the configuration hAuth, s0, t0i, of which it is assumed that the names in Auth
and the output messages t0 are included in the name-set s0. Suppose that the event
er is the input of a message {m}P ub(A) by agent A as initiator. Define a property
of subsets of messages t by
Q(t) iff ∀M ∈ t. m @ M ⇒ {m, A}P ub(B) @ M ,
where, for instance, m @ M means m is a submessage of M.
(c) Explain briefly why Q(t0) is true and Q(tr−1) is false. [6 marks]
(d) Describe, without proof, the possible form(s) of the earliest event ei
for which
Q(ti−1) is true while Q(ti) is false.
. Write program to Print first 5 even numbers using for loop
8. Write program to input and print the greater of three numbers.
9. Write program to input and print whether a number is positive or negative.
: Write complete java program that prompts the user for their name and two numbers.
In this question, you may use short fragments of C or C++ code to complement your
answer, where appropriate. Give a brief explanation of the following aspects of C
and C++:
(a) The differences between C pointers and C++ references. [Hint: Consider issues
of syntax, initialisation, mutation and safety in your answer.] [5 marks]
(b) How C and C++ object files may be safely linked with each other, and the
limitations in doing so for some C++ features. [5 marks]
(c) The difference between implementation-defined behaviour and unspecified
behaviour in the C standard, and an example of each sort of behaviour. Also
briefly discuss why these loosely specified behaviours exist in the C standard
instead of being strictly defined. [5 marks]
(d) The role of a debugger such as LLVM's lldb in locating bugs in C code, including
the use of breakpoints and watchpoints in an interactive debugger and how
symbol tables are useful. [5 marks]
3
Compiler Construction
Consider the following context-free grammar of expressions
E ::= n | (E, E)
where n ranges over integers.
(a) Present a right-most derivation of the expression ((21, 18), 17). [2 marks]
(b) List the LR(0) items for this grammar. [2 marks]
(c) Describe the states of the deterministic finite automata associated with an LR(0)
parser for the grammar presented above. Explain your method of constructing
these states. [4 marks]
(d) Describe the calculation of the goto function associated with an LR(0) parser
for the grammar above. How is the goto function used by the parser?
[4 marks]
(e) Carefully describe the LR(0) parsing associated with your derivation in (a).
That is, show each transition of the parser and how it performs shift and reduce
operations.
(a) Identify three programming or implementation concepts stemming from Algol or
Fortran which are still mainstream ideas, noting whether they arose from Algol
or Fortran. [3 marks]
(b) Give two comparable now-mainstream ideas, but excluding ideas directly
involving typing, which arose other than from Algol and Fortran. [2 marks]
(c) At machine-code level, a structured value typically contains some form of tag
indicating which of several variant forms the data may take (e.g. 'leaf' versus
'branch'); this determines how subsequent fields are to be interpreted (e.g. as
pointers, strings or floating-point values).
(i) Give code to show how type declarations in Java, ML and Pascal may be
used to describe such structured values, following the above description as
closely as possible. [5 marks]
(ii) For one of your type declarations identify a source of type unsafety that
can arise. [2 marks]
(d) What is the principal difference between statically typed and dynamically typed
languages? Identify one early and one more modern statically typed language.
Identify one early and one more modern dynamically typed language.
[3 marks]
(e) What is the principal difference between type-safe and type-unsafe languages?
Identify one type-safe language and one type-unsafe language, from any era.
[2 marks]
(f ) A downcast is a cast from a reference of a base class to a reference of one of its
derived classes. Discuss the extent to which Java and C++ are statically typed
and type-safe given that a downcast may fail at run-time.
Cambridge International AS & A Level Computer Science
ISBN: 9781510457591
1st Edition
Authors: David Watson, Helen Williams