EXAMINATION PAPER______CS1011___ MONTH____Jan_98_______ QUESTION NUMBER__________1______ (1st half only!) (a) design OR visible design |half (b) memory OR RAM |mark (c) a bus OR data+address links |each (d) operator OR function OR operation (e) operand OR address OR location (f)+(g) ACC + PC (h) instruction OR datain/out OR address OR similar (i) control access to files (j) 17th (k) Difference Engine (l) functions OR polynomials (m) Analytical Engine (n) Imperative (o) Functional (p) Logic (q) compiler (r) lexical (s) syntactic (t) semantic [Pete Capon sets the other half of question 1] EXAMINATION PAPER______CS1011___ MONTH____Jan_98_____ QUESTION NUMBER__________2______ a. PC->ALU->memory address |} read memory; |} 1 memory data_out->ALU->(function,operand) |} PC->ALU; inc->PC | 1 decode function... ...LDA operand->ALU->memory address |} read memory |} 1 memory data_out->ALU->ACC |} ...STO: operand->ALU->memory address |} ACC->ALU->memory data_in |} 1 write memory |} making details of movements explicit (as above) | 2 via ALU because minimises wiring etc.=cost (but slower) | 1 b. start: LDA x | 7 JGE x_ge_0 |-1 per LDA zero |error SUB x |(only STO x | deduct LDA zero | once SUB y | per STO y | kind x_ge_0:LDA x | of JNE x_gt_0 | error) STP x_gt_0:LDA x SUB one STO x LDA result ADD y STO result JMP x_ge_0 x: 6 y: 15 result: 0 zero: 0 one: 1 c. differences: variables, referential transparency, | 1 per sequence, transformation, functions first class, |point/ garbage collection, Turing/Church |example shared features: expressions, types, scope, state | max 7 d. 7-bits, white/black bars thickness = 1/2/3/4 * 0/1 bits | 1 + parity, left/right recognition | 1 so 2^7 combinations -> 10 digits | 1 + 1 extra digit encoding over US version | 1 either: more details/examples of EAN | 3 or: number -> database(s) to give price, promotions & special offers, stock levels, reordering, etc.