There is a cryptographic issue with this piece of PHP code. See the cryptographic issue (Choose one). Propose a fix.

There is a cryptographic issue with this piece of PHP code. See the cryptographic issue (Choose one). Propose a fix.

// empower an incitation code for a client $timestamp = time(); $first = substr(md5($user[‘loginname’] . $timestamp ), 0, 15); $third = substr(md5($user[’email’] . $timestamp), – 15); $activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);”hundreds” digit is one or two according to whether the first option is by l-value or r-value respectively, similarly with the “tens” digit for the second and with the “units” digit for the third option. [10 marks] Explain the structure of an object module which an assembler or compiler might produce to be processed by a linker. Your answer should include discussion of the various object module features needed to represent the compiled form of the C program: int a[10] = { 2,3,5,7,11,13,17,19,23,29 }; extern int b[10]; extern int g(int); int f(int y) { return g(y) + b[5] + a[6]; } [10 marks] 4 CST.98.6.5 6 Comparative Programming Languages Many languages either forbid explicit pointer arithmetic or restrict its use. What kinds of problem are they seeking to avoid? Why is it allowed (with some restrictions) in C and C++, and commonly used by programmers? [8 marks] What are the dangers inherent in allowing memory deallocation to be under the direct control of the programmer? Given these dangers, why has memory deallocation not been automated in standardised C or C++? [12 marks] 7 Prolog for Artificial Intelligence According to the rules of the Billy Badger Fan Club, an applicant is acceptable for membership provided that: • The applicant must have two proposers who are members of the club. • The applicant must be aged between 18 and 30 years of age (inclusive). • Each proposer must have been a member for at least two years. • Each

 

The application may be acknowledged to acclimate to the subsequent E + E let f(x,x) = Dseq; Cseq; E permit if E, C else C

Cseq – > C starting picture Dseq. Here n analyzes to number constants, x connects with

identifiers used as component names and f connects with identifiers used as brand name
During the 1950’s Admiral Grace Hopper, a mathematician and maritime power, made
the chance of an astounding PC program that would change over programs into machine language.
These early programming tongues essentially reflected the machine languages utilizing pictures or
mental associates to address the different language rules. These vernaculars were known as
delegate tongues. Since a PC doesn’t comprehend specialist language it should be
changed over into the machine language
escribe the benefits and weaknesses

of these methodologies. [5 marks]

The objective of this stage is to utilize JavaFX to add an exquisite and completely useful GUI to the game with the goal that it can all the more effectively be played on PCs. GUI ought to have the accompanying highlights:

• occasion treatment of mouse occasions, including buttons for beginning game and climbing/down/left/right;

• show of bitmap pictures (suggest utilize a few enormous pictures for the foundation entire game, and utilize a few little pictures for various things/cells in the guide, with the goal that the game looks proficient and engaging);

• different boards, with a principal gaming board to show the game, in addition to at least one boards around the edges to show game choices, score data, and control and help buttons and so on.;

• a spotless detachment between the back-end (game motor) and front-end (GUI) classes utilizing different Java bundle names, as depicted previously;

Begin by drawing a couple of paper portrays GUI intend to fabricate. Snap a picture of each sketch, as need might arise to incorporate these too
1 Compiler Construction
(a) Give two justifications for why a compiler is commonly separated into passes (or
stages) and show a common arrangement of passes and the information structures passed
between them. [4 marks]
(b) nd run inside numerous programs, could vary from that of
proposer must not be a parent of the applicant. Prolog program that includes a rule for deciding whether an applicant is acceptable for membership, illustrating with a sample database. [20 marks] 5 [TURN OVER CST.98.6.6 8 Databases Explain what is meant by a referential integrity constraint in a relational data model. [4 marks] The University of Cambridge is determined to maintain its standards under increasing financial pressure. The government maintains league tables of various kinds: teaching quality, research rating, unit cost of each student place. The university still enjoys a high reputation worldwide, but it is in competition with institutions such as MIT and Stanford whose unit costs are much greater. The only way to provide facilities such as new research laboratories, graduate accommodation, a much-needed swimming pool, is by public appeal. It is vital that there is close liaison between the university development offices and

 

colleges so that prospective donors do not become alienated by simultaneous demands. You have been invited by the university to assist in recording details of its fund-raising. The main purpose is to coordinate the activities of agencies such as the university and college development offices in their dealings with prospects. The latter may be alumni of some college, charitable foundations or major companies with an educational commitment; it is important to record their interests (bioscience, student welfare, sport) so that they can be approached in a favourable context; also their potential resources, in order to maximise the possible benefit to the university. At any time a number of projects need

 

funding: each will be developed by a single agency, requiring that a target sum be raised by a given date; projects will have one or more purposes which may be linked with the interests of prospects. The other main use of the database is to keep a diary of interaction with prospects; in order to retain their goodwill it is essential to know who has been invited where and when, and in what context. Design the schema for a relational database that will record this information. State clearly any assumptions that you need to make in order to complete the design, and indicate any difficulties that you foresee in maintaining the database. [16 marks] 6 CST.98.6.7 SECTION C 9 Foundations of Functional Programming The binary trees, denoted by B, whose branch nodes contain natural numbers, are generated by the gramma1. Text-based play: The main() method of GameEngine class should support a text-based game play in the console.
2. Class Relationships: engine needs to include several Java classes, with some association/composition relationships between them, and if possible, some inheritance/interface usage.  Think about where can best use these Java features.

 

Question 3: Game GUI: The goal of this stage is to use JavaFX to add an elegant and fully functional GUI to the game so that it can more easily be played on desktop computers.  GUI should have the following features:

• event-handling of mouse events, including buttons for starting game and moving up/down/left/right;

• display of bitmap images (recommend use some large images for the background whole game, and use some small images for different items/cells in the map, so that the game looks professional and entertaining);

• multiple panels, with a main gaming panel to display the game, plus one or more panels around the edges to display game options, score information, and control and help buttons etc.;

• a clean separation between the back-end (game engine) and front-end (GUI) classes using different Java package names, as described above;

Start by drawing one or two paper sketches GUI plan to build.  Take a photo of each sketch, as will need to include these as well
1 Compiler Construction
(a) Give two reasons why a compiler is typically broken down into passes (or
phases) and indicate a typical set of passes and the data structures passed
between them. [4 marks]
(b) nd run within many browsers, might differ from that of
compiling an application and running it multiple times on a single machine. B ::= Leaf | Br (n, B, B) where n ranges over natural numbers. Although this question concerns the encoding of binary trees as λ-terms, you may use the encodings of other well-known data structures, such as booleans and pairs, provided you state the properties assumed. Give an encoding of binary trees as λ-terms by defining as λ-terms (a) Leaf and Br, used to construct the λ-terms corresponding to binary trees; (b) isLeaf, which tests whether a λ-term corresponds to a leaf or a branch node; (c) value, fstsubtree and sndsubtree, used to identify respectively the natural number and the two subtrees at a branch node. Justify your answer by describing the behaviour of isLeaf, value, fstsubtree and sndsubtree: for example, the reduction isLeaf(Leaf) true describes part of the behaviour of isLeaf. [8 marks] Consider the function treeadd defined inductively on the structure of binary trees by treeadd (m, Leaf) = Leaf treeadd (m, Br (n, B1, B2)) = Br (m + n,treeadd (m, B1),treeadd (m, B2)) Give and justify a λ-term which encodes treeadd, using the λ-term Y ≡ λf.(λx.f(xx))(λx.f(xx)). [6 marks] Give the λ-term for the infinite binary tree whose branch nodes consist of zeros at even depths and ones at odd depths, as pictured below: 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 . . . [6 marks] 7 [TURN OVER CST.98.6.8 10 Logic and Proof Outline the concepts behind modal logic. Illustrate your answer by explaining the meaning of the axiom A → tu A. [6 marks] Attempt to prove, using rules for S4, the following sequents: tu(A ∨ B) ⇒ (tuA) ∨ (tuB) (tuA) ∨ (tuB) ⇒ tu(A ∨ B) For each sequent, briefly explain why it is valid (or is not, as the case may be). [4 + 4 marks] Use resolution to derive a contradiction from this set of clauses: {¬P(x, x), P(x, a)} {P(x, x), P(x, f(a))} {¬P(y, f(x)), ¬P(y, x)} [6 marks] 8 CST.98.6.9 11 Complexity Theory Here are some informally expressed opinions about computational complexity. They may be correct, incorrect, misleading or meaningless.

ordering an application and running it on numerous occasions on a solitary machine. B ::= Leaf | Br (n, B, B) where n ranges over regular numbers. Albeit this question concerns the encoding of parallel trees as λ-terms, you might utilize the encodings of other notable information structures, for example, booleans and matches, gave you express the properties expected. Give an encoding of paired trees as λ-terms by characterizing as λ-terms (a) Leaf and Br, used to develop the λ-terms relating to double trees; (b) isLeaf, which tests whether a λ-term relates to a leaf or a branch hub; (c) esteem, fstsubtree and sndsubtree, used to distinguish individually the normal number and the two subtrees at a branch hub. Legitimize your response by portraying the way of behaving of isLeaf, esteem, fstsubtree and sndsubtree: for instance, the decrease isLeaf(Leaf) genuine depicts part of the way of behaving of isLeaf. [8 marks] Consider the capability treeadd characterized inductively on the construction of twofold trees by treeadd (m, Leaf) = Leaf treeadd (m, Br (n, B1, B2)) = Br (m + n,treeadd (m, B1),treeadd (m, B2)) Give and legitimize a λ-term which encodes treeadd, utilizing the λ-term Y ≡ λf.(λx.f(xx))(λx.f(xx)). [6 marks] Give the λ-term for the limitless paired tree whose branch hubs comprise of zeros at even profundities and ones at odd profundities, as presented underneath: 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 . . . [6 marks] 7 [TURN OVER CST.98.6.8 10 Logic and Proof Outline the ideas driving modular rationale. Represent your response by making sense of the significance of the maxim A → tu A. [6 marks] Attempt to demonstrate, involving rules for S4, the accompanying sequents: tu(A ∨ B) ⇒ (tuA) ∨ (tuB) (tuA) ∨ (tuB) ⇒ tu(A ∨ B) For each sequent, momentarily make sense of why it is substantial (or isn’t, by and large). [4 + 4 marks] Use goal to get an inconsistency from this arrangement of conditions: {¬P(x, x), P(x, a)} {P(x, x), P(x, f(a))} {¬P(y, f(x)), ¬P(y, x)} [6 marks] 8 CST.98.6.9 11 Complexity Theory Here are a few casually offered viewpoints about computational intricacy. They might be right, mistaken, deceiving or inane. In some

cases reality or in any case of the assertion probably won’t be known, either in that frame of mind of it not having been shrouded in the course or by the response not being known by anyone anyplace. For every assertion remark on its legitimacy and in situations where that is both important and clear produce a changed variant of the perception that is appropriately legitimate. You are not supposed to incorporate verifications to help your cases. (a) Problems that are not NP-re simple to tackle. [3 marks] (b) Problems that are NP-finished won’t ever be tackled in that frame of mind of time despite the fact that PCs keep on getting quicker and quicker. [3 marks] (c) To test a number N to see whether it is prime you simply need to do testdivision by every one of the numbers from 2 to N − 1, and since there are just N −2 of these and division should be possible in time O(n 2 ) this is polynomial time. In this manner primality testing is in the class P. [4 marks] (d) There is a polynomial-time decrease from the k-club issue to 3-SAT. [3 marks] (e) There is a polynomial-time decrease from 3-SAT to the k-inner circle issue. [3 marks] (f ) There have been proposition that organic PCs in view of DNA could utilize the enormous parallelism of their biochemical movement to quickly take care of NP issues. In the event that such frameworks could be made to work dependably this would tackle the hypothetical test presented by the idea of NP-culmination. [4 marks] 9 [TURN OVER CST.98.6.10 12 Semantics of Programming Languages What is implied by a named progress framework? [2 marks] A language of orders, C, for intuitive info/yield is given by C ::= skip | ‘ := ‘ | getc(‘) | putc(‘) | C ; C | in the event that ‘ = ‘, C else C | while ‘ = ‘ do C where ‘ ranges over some decent arrangement of areas for putting away characters. The order ‘1 := ‘2 duplicates the items in ‘2 to ‘1. The order getc(‘) peruses the following person from the standard info stream into ‘. The order putc(‘) composes the items in ‘ to the standard result stream. The restrictive and keeping in mind that circle orders include testing whether the items in two areas are equivalent. The orders skip and C1 ; C2 have their standard implications. Characterize a functional semantics for this language as a marked change framework whose setups are (order, state)-

Yet again two or three banks register the sponsor PIN through scrambling the record number

the usage of DES and a critical saw best to their essential systems and ATMs, taking the first

4 hex digits of the result, changing the digits A, . . . , F with 0, . . . , 5 independently,

in conclusion, if the principal digit of the eventual outcome is zero, superseding it with a 1. What is the

chance that a culprit can get the PIN authentic given 3 assumptions? [5 marks]

Anyway various banks have used DES, and a key perceived only to their huge plans and

ATMs, to scramble the PIN (whether randomly created or client picked); they

then, at that point, create the result at the appealing strip on the purchaser’s card, all together that the ATM

can look at it regarding the central device. Depict the dangers

of this alliance. [5 marks]

To hinder assaults subordinate totally after controlling appealing strips, banks in a couple

overall regions have moved to the usage of splendid playing a game. What effect would you surmise this sort of

move to have on the inescapability of card-generally based distortion? [5 marks]

A. Use of Hard-coded Cryptographic Key

B. Use of a Broken or Risky Cryptographic Algorithm

C. Senseless Validation of Certificate with Host Mismatch

D. Use of a Certificate Past its Expiration Date

Near the day’s end, we genuinely need to have the choice

to switch the message over totally to shield it from a

interloper, yet we in like manner need to have the choice to

get the chief message back so the beneficiary can

examine it fittingly. The cryptosystem combines a ton

of rules for how to encode the plaintext and how to decipher

the code text. The encryption and deciphering rules, called

computations, continually use a contraption called a key,

proposed by K, with the objective that the accompanying code

message depends on the first plaintext message, the appraisal,

what’s more, the key worth. We make this dependence as C =E (K, P).

For the most part, E is a lot of encryption estimations, and

the key K picks one express appraisal from the set.

There are different sorts of encryption. In the going with

regions we see two clear kinds of encryption: substitutions

in which one letter is exchanged for one more and renderings,

in which the deals for the letters is overhauled. Cryptanalyst:

cryptanalyst is a person who revolves around encryption

what’s more, encoded message and endeavors to find the tremendous

suggestions (to break an encryption). Disorder: it is a technique

for ensuring that ciphertext has almost no experience with

the main message. Dispersal: it constructs the unquestionable dreariness

of the plaintext by spreading it across lines and parcels.

Propose a Fix: __
check out at the going with code and show which line of code that would
accomplish a compiler fumble and those lines that would sort out, yet would accomplish an execution bungle. In
examining each line, recognize that every one of the right lines above it have executed.

Kid snoopy, woodstock;
Kid ali, ahmed;
Young person saba, sally;
snoopy = new Kid(“snoopy”);
ali = new Boy(“ali”);
ahmed = new Kid (“ahmed”);
ahmed = snoopy;
ahmed = (Boy) snoopy;
woodstock = new Boy(“pigpen”);
ahmed = woodstock;
ali = (Boy) woodstock;
saba = new Girl(“saba”);
sally = saba;
ahmed = (Boy) saba;