Question: 2 CST.2016.3.3 2 Programming in C and C++ (a) Consider unspecified behaviour in C. a) Software design is an important process in software development lifecycle.

2 CST.2016.3.3 2 Programming in C and C++ (a) Consider unspecified behaviour in C. a) Software design is an important process in software development lifecycle. However, a lot of software developer/house tends to ignore the process. Therefore, provide and explain 2 motivations on software design

(i) What scheduling problem could arise here? [2 marks] (iV) How could this problem be overcome? [2 marks] (d) The designer also wishes the real-time sy

(i) (c) (d) Assume x = y = z = m. Using worst-case analysis, estimate xy, xy. Find an expression for w where w = z xy. [4 marks](e) Give a brief and rudimentary clarification of the standards of how the language coming about because of part (b) may be utilized to a sentence structure analyser taking a token stream as information (by means of calls to work lex()) and giving as result an theoretical language structure tree relating to part (d). Sketch a proof of Cook's result, that the problem 3-SAT is NP complete.

Justify that any transformations you introduce are polynomial.Write java program that asks the user to enter 2 integers, obtains them from the user, determines if they are even or odd numbers and prints their sum, product, difference, and quotient (Division)

Write program that prompts the user to read two integers and displays their sum. Your program should prompt the user to read the number again if the input is incorrect. Pure lambda-calculus does not have any built-in control structures or arithmetic.

It just has lambda-expressions.

(a) Using an untyped pure lambda calculus, explain how to model the natural

numbers 0, 1, . . . together with a test for zero and addition and multiplication

operations. [7 marks]

(b) How can recursive function definitions be expressed in pure lambda calculus?

Give a lambda-term for any special things that you need to introduce.

[4 marks]

(c) Suppose you are provided with a lambda expression that works with numbers

in the sense of part (a) above and which will find the predecessor of any nonzero number. Express the factorial function in terms of the primitives that

you introduced in parts (a) and (b). [5 marks]

(d) Explain how a typical polymorphic typing system would respond to the various

lambda-expressions you have given. If there were any that would fail to

type-check, explain why: if everything you have written could be given valid

polymorphic types, show what those types would be for a couple of the key

expressions. [4 marks]

Credit will be given for clarity and conciseness of presentation, and justification of

why your lambda expressions apply in the general case will be preferred to sets of

examples that merely illustrate them in particular cases.

9 [TURN OVER

CST.2004.5.10

11 Semantics of Programming Languages

The language L has expression syntax

e ::= n | skip | fn x:T e | e1 e2 | x | e1 := e2 |!e | refe | `

with types

T ::= int | unit | T1 T2 | T ref

It is intended to have a call-by-value semantics.

(a) Define the set of values for L. [2 marks]

(b) Give type rules and reduction rules for the store-related expressions

e1 := e2 |!e | refe | `. Define clearly what the type environments and stores

you are using are. [10 marks]

(c) Discuss possible alternative choices for the semantics of the operations in

part (b), paying particular attention to: (i) what can be stored, (ii) store

initialisation, and (iii) the results of assignments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!