Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Discuss the reasons why languages such as Fortran, Algol and PL/I designed in 1950s and 1960s are less widely used than languages designed in the

Discuss the reasons why languages such as Fortran, Algol and PL/I designed in 1950s and 1960s are less widely used than languages designed in the last 20 years. [6 marks] 3 [TURN OVER CST.2004.3.4 5 Briefly describe the calling mechanisms just mentioned and discuss why most modern programming languages provide only call by value. [18 marks] (c) Discuss the reasons why languages such as Fortran, Algol and PL/I designed in 1950s and 1960s are less widely used than languages designed in the last 20 years. [6 marks] i) What scheduling problem could arise here? [2 marks] (ii) How could this problem be overcome? [2 marks] (d) The designer also wishes the real-time system to use demand paged virtual memory for efficiency.

[14 marks] (f ) The rate of heat energy flow from a hotter to a cooler object is their temperature difference divided by their insulation resistance. When two fluids are mixed the resultant temperature is the sum of their initial temperatures weighted by their proportions. (b) You are designing and are about to launch a mobile phone app which will seek to understand the emotional condition of the user, using multiple inputs such as motion sensing, facial expression recognition, voice stress measurement and the analysis of entered text. Its declared purpose is to enable services to interact more empathically with users. The lasting romance remains, alas, just a dream. His latest obsession is a toasted sandwich-maker called SN0008011666833. In order to win her affections he plans to buy her a chocolate muffin from her favourite shopFat Finbar's World of Cakebefore stealing a bunch of flowers from the local ccemetery, giftwrapping the presents, and presenting both gifts to her. Note: The Compiler Construction Programming answers should be written in some notation approximating SML or OCaml. (a) Describe what is meant by tail recursion. [4 marks] (b) Eliminate tail recursion from foldl given below. Explain your answer. (* foldl : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a *) let rec foldl f accu l = match l with [] -> accu | a::l -> foldl f (f accu a) l [8 marks] (c) Eliminate tail recursion from the following mutually tail-recursive functions. Explain your answer. let rec is_even n = if n = 0 then true else is_odd (n - 1) and is_odd n = if n = 0 then false else is_even(n - 1) [8 marks] 4 CST.2016.3.5 4 Compiler Construction Consider writing a compiler for a simple language of expressions given by the following grammar, e ::= n (integer) | ? Write brief notes on: (a) the data that would be stored for each triangle; [2 marks] (b) perspective projection from an arbitrary viewpoint; [5 marks] (c) clipping the data to a suitable viewing frustrum; [5 marks] (d) identifying pixels on the screen within a triangle; [3 marks] (e) resolving hidden surfaces using a z -buffer. [5 marks] 5 (TURN OVER) CST.2014.4.6 5 Databases Suppose that an Entity-Relationship model has been constructed that contains two entities S(A, B) and T(C, Amount), where A, B, C and Amount are attributes and the underline indicates a key. Suppose that we also have a many-to-many relationship R between S and T. The idea is that the computation is run asynchronously and the calling thread only blocks if it tries to use a result that hasn't been computed yet. An example program using a future is shown below. Future f = new Future() { @Override public String execute() { // ...long running computation... return data; }; // ... String result = f.get(); // blocks if execute() unfinished Use wait() and notifyAll() to provide an implementation of the Future class that would work with the example program above. [10 marks] (c) Give one potential advantage and one potential disadvantage of using notify() instead of notifyAll(). [2 marks]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

What is an e-marketplace?

Answered: 1 week ago