Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Subnet Table: Subnet Description Network Address First Host Address Second Host Address Last Host Address Broadcast Address Subnet Mask Network P Network Network R Network

Subnet Table: Subnet Description Network Address First Host Address Second Host Address Last Host Address Broadcast Address Subnet Mask Network P Network Network R Network X NA Network Y NA Network Z NA Part 2: Complete the Addressing Table Document the addressing scheme and complete the addressing table. a. Assign the Last host IP address from Network P subnet to G0/1 interface of Ri. Briefly describe the calling mechanisms just mentioned and discuss why most modern programming languages provide only call by value. Discuss the reasons why languages such as Fortran, Algol and PL/I designed in 1999s and 2000s are less widely used than languages designed in the last 30 years. (a) Consider unspecified behaviour in C. (i) Define what unspecified behaviour means in the C standard and give two examples of such behaviour. [3 marks] (b) Briefly explain why it is important to have unspecified behaviour in the definition of the C language. [1 mark] (ii) The role of the C preprocessor in the source-code compilation cycle, and why it is a useful tool for debugging. [4 marks] (c) Describe what is meant by tail recursion. he 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] (d) Would it have been beneficial to use notify() instead of notifyAll() in your implementation? Justify your answer. [3 marks] 7 (TURN OVER) CST.2016.3.8 7 Prolog In this question you should ensure that your predicates behave appropriately with backtracking and avoid over-use of cut. You should provide an implementation of any library predicates used. You may not make use of extra-logical built-in predicates such as findAll. Minor syntactic errors will not be penalised. (a) Rewrite chooseAll without using not and cut (!). [10 marks] chooseAll(N,L,Res) :- chooseAll(N,L,[],Res). chooseAll(N,L,Seen,Res) :- choose(N,L,R), not(member(R,Seen)), !, chooseAll(N,L,[R|Seen],Res). chooseAll(,,Res,Res). (e) What is Last Call Optimisation and why is it beneficial? [3 marks] (f ) Rewrite pos to enable Last Call Optimisation. [2 marks] pos([],[]). pos([H|H],[H|R]) :- H >= 3, pos(T,R).

The lasting romance remains, alas, just a dream. His latest obsession is a toasted sandwich-maker called SN00dd005833. 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 cemetery, giftwrapping the presents, and presenting both gifts to her. Evil Robot's internal systems have been constructed using the situation calculus and a theorem prover. (a) Describe the situation calculus, concentrating on the fundamental elements that you would expect to see independently of any specific problem. [5 marks] (b) Suggest two logical formulae that might appear in Evil Robot's knowledge base in order to describe the initial state for the above problem. [2 marks] (c) Give two examples of a possibility axiom that might appear in the knowledge base. [4 marks] (d) Give two examples of a successor-state axiom that might appear in the knowledge base. One of these should in addition address the ramification problem. Explain how it does this. [6 marks] (e) Give one example of a unique names (* 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) | ? (read integer input from user) | e + e (addition) | e e (subtraction) | e e (multiplication) | (e, e) (pair) | fst e (first projection) | snd e (second projection) (a) Describe the tasks that should be carried in implementing a front end for this language and any difficulties that might be encountered. Eliminate tail recursion from foldl given below. [8 marks] 4 Comparative Programming Languages (a) Discuss to what extent a programmer can expect a program that conforms to a standard to generate identical results when run under different conforming compilers on different machines. [6 marks] (b) ALGOL 60 provided call by value and call by name, Pascal provided call by value and call by reference, and ALGOL-W provided a variety of calling methods including call by result and call by value-result. . [6 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

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions