Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question concerns the portrayal of parse tree hubs for articulations made out of number constants, identififiers, and whole number administrators for expansion, deduction, increase

This question concerns the portrayal of parse tree hubs for articulations

made out of number constants, identififiers, and whole number administrators for expansion,

deduction, increase and division. In a typeless language, like BCPL,

every hub can be executed as a vector whose fifirst component holds a whole number

distinguishing the hub administrator. The size of the vector and the sorts of significant worth held in

different components then relies upon this hub administrator.

(a) Complete the portrayal of how you would address such whole number articulations

in a typeless language. [5 marks]

(b) Suggest how you would address such number articulations in C and either ML

or on the other hand Java. [10 marks]

(c) Brieflfly talk about the overall benefits of your C information structure contrasted and that

utilized in the typeless methodology. [5 marks]

6 Compiler Construction

(a) Assuming a Java type is given to every variable, express a technique by which an

over-burden administrator, (for example, +,- and so forth) in a Java program not entirely set in stone

to be an int, genuine or other administrator. [3 marks]

(b) Explain, involving pseudo-code as proper, how to change over a sentence structure tree into

stack code, for example, that utilized in the JVM. For the reasons for this inquiry, you

just need consider trees addressing assemblages of void-returning capacities, and

these bodies just as comprising of a rundown of proclamations of the structure int x = e;

or on the other hand x = e; where x reaches over factors and e over articulations; articulations

contain factors, number constants, the parallel administrator + and static technique

summons. [10 marks]

(c) Show how an arrangement of straightforward stack code guidelines, for example, those utilized

in your response to part (b) above, can be converted into an arrangement of

directions for a register-situated design of your decision, for instance

ARM or Pentium. [7 marks]

5

[TURN OVERCST.2002.5.6

7 Prolog for Artifificial Intelligence

(a) Give a straightforward defifinition of the Prolog predicate dfx that can perform emblematic

difffferentiation concerning the variable x of articulations made out of

whole numbers (for example 0, 1, . . .), representative constants (for example a, b, . . .), representative factors

(for example x, y, . . .) and the administrators +, - and *, for expansion, deduction and

increase. The fifirst contention of dfx is the articulation to difffferentiate

what's more, the subsequent contention is the outcome. Your defifinition need not play out any

simplifification of the outcome. [6 marks]

(b) Trace the execution of the call: dfx(x*x-2, R). [2 marks]

(c) Now adjust your defifinition with the goal that it simplififies the outcome by the applications

of revamping rules, for example, 1*x?x and x-0?x. [8 marks]

(d) Discuss how much, if any, both of your predicates could be utilized to

coordinate an articulation. [4 marks]

8 Databases

(a) Describe the social model of information. [6 marks]

(b) Explain the accompanying ideas in social information bases:

(I) substance honesty limitation; [1 mark]

(ii) unfamiliar key and how it can indicate a referential honesty limitation

between two relations; [4 marks]

(iii) semantic uprightness requirement. [1 mark]

(c) (I) What is a practical reliance? [1 mark]

(ii) Defifine Boyce-Codd Normal Form (BCNF). [3 marks]

(iii) Defifine Third Normal Form (3NF). [3 marks]

(iv) What is the connection among BCNF and 3NF? [1 mark]

6CST.2002.5.7

Area C

9 Semantics of Programming Languages

(a) The whole number articulations

e

of a C-like language take the structure

e ::= n | x | x++ | ++x | e + e, where n ranges over whole number constants and

x over number capacity factors. The articulation x++ returns the worth put away

in the whole number variable x and afterward increases the put away worth by one; though

++x fifirst increases the put away worth by one and afterward brings it back. Expecting

a left-to-right assessment request, give a functional semantics for every one of these

articulations, as an assessment connection h s, ei ? hs0 , ni , where s, s0

range over states which are fifinite capacities from whole number stockpiling factors to

numbers. [5 marks]

(b) The orders (explanations) c of this equivalent language take the structure

c ::= x = e | x += e | c;c. The fifirst structure is task and the latter is

sequencing; the order x += e assesses e, adds the outcome to the worth

put away in x and stores the outcome there. Give a functional semantics for these

orders as an assessment connection h s, ci ? s0 (where s, s0 are as

above). [4 marks]

(c) Defifine the thought of semantic proportionality for these articulations and orders.

[3 marks]

(d) For every one of the accompanying sets of articulations or orders, state, with

justifification, if they are semantically same.

(I) ++x and x++ + 1

[2 marks]

(ii) x = ++x and x = x++

[2 marks]

(iii) x = ++x and x += 1

[2 marks]

(iv) x += e and x = x + e, for any e

[2 marks]

7

[TURN OVERCST.2002.5.8

10 Foundations of Functional Programming

(a) Explain how a lambda-term can be changed over into a structure that utilizes just the

combinators S and K. [4 marks]

(b) Illustrate your technique by recording a lambda term for every one of the accompanying

capacities and afterward communicating it concerning just S and K.

(I) fun I x = x

(ii) fun B f g x = f (g x)

(iii) fun C f x y = f y x

(iv) fun A x y = y (x y)

[4 imprints each]

11 Logic and Proof

(a) For every one of the accompanying formulae, state (with justifification) whether it is

satisfifiable, legitimate or not one or the other:

((Q ? R) ? Q) ? Q

[2 marks]

((P ? Q) ? P) ? Q

[2 marks]

?xy [P(x, y) ? ?xy P(x, y)] [3 marks]

[?x (P(x) ? Q(x)) ? ?x P(x)] ? ?x Q(x) [3 marks]

(b) Brieflfly frame the semantics of fifirst-request rationale, taking as an illustration the

recipe ?xy f(x, y) = f(y, x). [6 marks]

(c) Exhibit a model that satisfifies both of the accompanying formulae (a will be a consistent):

?x g(x)

6

=

a

?xy [g(x) = g(y) ? x = y]

[4 marks]

8CST.2002.5.9

12 Complexity Theory

(a) Give an exact defifinition of what is implied by the proclamation that a choice

issue An is polynomial-time reducible to a choice issue B. [2 marks]

(b) Consider the accompanying three choice issues on diagrams.

Associate ? the assortment of diagrams G to such an extent that there is a way between

any two vertices of G.

Hamilton ? the assortment of charts that contain a Hamiltonian cycle.

non-3-variety ? the assortment of diagrams that are not 3-colourable.

For every one of the accompanying assertions, state whether it is valid, misleading or an

unsettled open inquiry. Offer a short justifification for your response.

(I) Connect is decidable by a polynomial time calculation.

(ii) Hamilton is decidable by a polynomial time calculation.

(iii) non-3-variety is decidable by a polynomial time calculation.

(iv) Connect is polynomial-time reducible to Hamilton.

(v) Hamilton is polynomial-time reducible to non-3-variety.

(vi) non-3-variety is polynomial-time reducible to Connect.

imageimage

Which statements regarding Mergesort is correct? Choose all that apply. A. The worst-case complexity of the algorithm is cubic B. The worst-case complexity of the algorithm is linear 00000000 C. The worst-case complexity of the algorithm is constant D. The worst-case complexity of the algorithm is quadratic E. Ordering of the input data affects the average-case complexity F. The worst-case complexity of the algorithm is superlinear G. Ordering of the input data does not affect the average-case complexity H. The worst-case complexity of the algorithm is logarithmic What statements are true with regards to the use of memcpy? Choose all options that apply. A. Dynamic allocation of arrays during program run-time B. Static allocation of large arrays C. Copying arrays during program run-time D. Dynamic resizing of arrays during program run-time What statement regaring a DFS (depth-first search) traversal of an undirected graph, G, with set of edges, E, is correct? Choose all that apply. A Every edge in either a tree edge or a back edge B. Every edge in either a tree edge or a cross edge c.very gentis ether a tree edge or forward D. Every edge in E can be a tree edge 3 z

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

Financial accounting

Authors: Walter T. Harrison, Charles T. Horngren, William Bill Thomas

8th Edition

9780135114933, 136108865, 978-0136108863

More Books

Students also viewed these Computer Network questions

Question

Did the researcher use negative case analysis?

Answered: 1 week ago