One version should be in C, and the other should use C++ language features. [4 marks] (c) (ii) Briefly explain why it is important to have unspecified behaviour in the definition of the C language. [1 mark] (b) Compare and contrast the struct and union keywords in C, supplying an example of a situation where it would be more appropriate to use a union rather than a struct. [4 marks] (c) Explain the following C or C++ language concepts. You may find it helpful to use short code fragments or diagrams to illustrate your answer. 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|T],[H|R]) :- H >= 0, pos(T,R). pos([H|T],R) :- H < 0, pos(T,R). 8 CST.2016.3.9 8 Software Engineering Discuss the contribution and the relative value of the following aspects of the modern development environment. Illustrate with examples from your group project, or from experience you gained working for a commercial software developer, or both. In each case, would you discard this feature if your employer let you, or insist on retaining it (even covertly) should your employer not value it? Explain your reasons. (c) The number of outputs is arbitrary. We have a sequence s of m labelled training examples s = ((x1, l1),(x2, l2), . . . ,(xm, lm)) where the li denote vectors of desired outputs. Let E(w; (xi , li)) denote some measure of the error that N makes when applied to the ith labelled training example. Assuming that each node in the network computes a weighted summation of its inputs, followed by an activation function, such that the node j in the network computes a function g w (j) 0 + X k i=1 w (j) i input(i) ! of its k inputs, where g is some activation function, derive in full the backpropagation algorithm for calculating the gradient ∂E ∂w = ∂E ∂w1 ∂E ∂w2 · · · ∂E ∂wW T for the ith labelled example, where w1, . . . , wW denotes the complete collection of W weights in the network. 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 Find a data source you are interested in exploring. Explore an ethical or societal issue introduced by the data and explained by the data. Examples: you could choose a specific country and research why measles vaccine rates developed as they did (e.g. effects of colonization, funding, political opposition, etc.); you could investigate the role of the World Bank and World Health Organization and how they make these measurements and what purposes they serve. a Report about the data and your findings, supported by visualizations generated using the dataset in Python Deliverables (marked collectively):The program will always read from "measles.csv" (it will not prompt the user for the name of the input file). If it is unable to open that file, the program will halt with an error message. Use a visualization library (e.g. pandas) to graph the data with the appropriate chart furniture. The program portraying the aspects you will focus on in the report. Include these images in the report. Submit the code used to generate the graphs along with the report Suggestions for Report Content. (2) What is the goal of software design? What would be different if developers went straight to coding without adhering to software design principles? (d) Which of the lookup mechanisms in part (b) is usually used for a TLB and why aren't the other mechanisms usually used? [6 marks] 2 ECAD Consider the following mysterious Verilog module. module mystery(c,r,a,s); input c,r,a; output [2:0] s; reg [2:0] s; always @(posedge c or posedge r) if(r) s<=0; else begin if(a && (s<7)) s<=s+1; else if(!a && (s>0)) s<=s-1; end endmodule (a) How many flip-flops will be required to implement the mystery module, and how will signals c and r be connected to these flip-flops? [5 marks]