Six original Cambridge-style questions on programming paradigms, including an assembly trace and writing facts and rules, with mark-scheme solutions.
Explain what is meant by a programming paradigm and describe the main characteristics of the imperative (procedural) paradigm.
Address 200 holds 204, address 201 holds 3, address 202 holds 8, address 203 holds 1 and address 204 holds 6. The index register holds 2. State the value in the accumulator after each instruction is executed separately:
LDM #201 LDD 201 LDI 200 LDX 201
The following facts describe a family:
30 parent(rosa, tom). 31 parent(rosa, ivy). 32 parent(tom, max). 33 parent(ivy, zoe).
(a) Write a rule grandparent(X, Y) that is true if X is a grandparent of Y. (b) Write a rule sibling(X, Y) that is true if X and Y have the same parent and are different people. (c) State the result of the goal grandparent(rosa, Y).
Using the clauses in question 3, state the result of each goal: (a) parent(X, zoe) (b) sibling(tom, Y) (c) grandparent(tom, Y).
Compare the low-level and declarative paradigms.
A company wants (a) a driver for a new sensor that must run in very little memory and (b) a system that advises which medicine to give from a set of symptoms. Suggest a suitable paradigm for each and justify your choices.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.