1) Write declarations for the following: a function taking…

Question Answered step-by-step 1) Write declarations for the following: a function taking… 1) Write declarations for the following: a function taking arguments of type pointer to char-acter and reference to integer and returning no value; a pointer to such a function; a functiontaking such a pointer as an argument; and a function returning such a pointer. Write the defi-nition of a function that takes such a pointer as an argument and returns its argument as thereturn value. Hint: Use a type alias (using).[2] ( ∗1) What does the following mean? What would it be good forusing riffi = int (&) (int, int);[3] ( ∗1.5) Write a program like ”Hello, world!” that takes a name as a command-line argumentand writes ”Hello, name !”. Modify this program to take any number of names as argumentsand to say hello to each.Consider the following story of the play Macbeth, by William Shakespeare:The characters are Macbeth, Lady-Macbeth, Duncan and Macduff.Macbeth is an evil noble. Lady-Macbeth is a greedy ambitious woman.Duncan is a king. Macduff is a loyal noble. Macbeth is weak becauseMacbeth married Lady-Macbeth and because Lady-Macbeth is greedy.Lady-Macbeth persuades Macbeth to want to be king. Macbeth murdersDuncan using a knife because Macbeth wants to be king and becauseMacbeth is evil. Lady-Macbeth kills Lady-Macbeth. Macduff is angrybecause Macbeth murdered Duncan and because Macduff is loyal toDuncan. Macduff kills Macbeth.Construct a semantic network representing the above story. [8 marks]Show the chain of reasoning leading to Macduff killing Macbeth. [5 marks]It is possible to change the story so that Lady-Macbeth is unable to persuadeMacbeth to want to be king. Augment the story to provide a reason forLady-Macbeth’s inability to persuade Macbeth to want to be king. Update thesemantic network to reflect the new situation. [7 marks]10 Numerical Analysis IIExplain the terms (a) positive definite, (b) positive semi-definite for a symmetricmatrix A. If a square matrix B is non-singular, which of the properties (a) or (b)most accurately describes BT B? What if B is singular? [4 marks]State Schwarz’s inequality for the product AB. In what way is this modified forthe product Ax, where x is a vector? What are the singular values of A, andhow are they related to the l2 norm of A? In the singular value decompositionA = UWVT, what is W? [5 marks]Let ˆx be an approximate solution of Ax = b, and write r = b − Aˆx, e = x − ˆx.Find an expression which is an upper bound for the relative error ||e||/||x|| in termsof computable quantities. Explain how this result may be interpreted if the l2 normis used. [8 marks]Suppose A is a 5 × 5 matrix and Ax = b is to be solved by singular valuedecomposition. If machine epsilon ‘ 10−15 and the singular values of A are1, 10−6, 10−10, 10−17, 0 write down the generalised inverse W+ that you would use.  Describe an algorithm for performing scan conversion of a set of 3D polygons,including details of clipping, projection, and the underlying 2D polygon scanconversion algorithm. You may assume that you are given the colour of eachpolygon and that no lighting calculations are required. Please state any additionalassumptions that you need to make. Ray tracing is not an acceptable answer tothis question. [20 marks]11 Introduction to Security(a) Explain briefly mechanisms that software on a desktop computer can use tosecurely generate secret keys for use in cryptographic protocols. [5 marks](b) Give two different ways of implementing residual information protection in anoperating system and explain the threat addressed by each. [5 marks](c) Consider the standard POSIX file-system access control mechanism:(i) Under which conditions can files and subdirectories be removed from aparent directory? [2 marks](ii) Many Unix variants implement an extension known as the “sticky bit”.What is its function? [2 marks](iii) On a POSIX system that lacks support for the “sticky bit”, how couldyou achieve an equivalent effect? [2 marks](d) VerySafe Ltd offer two vaults with electronic locks. They open only after thecorrect decimal code has been entered. The VS100 – a low-cost civilian model- expects a 6-digit code. After all six digits have been entered, it will eitheropen or will signal that the code was wrong and ask for another try. The VS110- a far more expensive government version – expects a 40-digit code. Users ofa beta-test version of the VS110 complained about the difficulty of enteringsuch a long code correctly. The manufacturer therefore made a last-minutemodification. After every five digits, the VS110 now either confirms that thecode has been entered correctly so far, or it asks for the previous five digitsagain. Compare the security of the VS100 and VS110.Consider the following four documents that would have improved projects suchas the Cambridge University CAPSA project or the London Ambulance Servicesystem:(a) a plan for managing development risk;(b) a safety and reliability specification;(c) a user requirements document;[4] ( ∗1.5) Write a program that reads an arbitrary number (possibly limited to some maximumnumber) of files whose names are given as command-line arguments and writes them oneafter another on cout. Because this program concatenates its arguments to produce its output,you might call it cat.[5] ( ∗2) Convert a small C program to C++. Modify the header files to declare all functionscalled and to declare the type of every argument. Where possible, replace #defines withenum, const, constexpr, or inline. Remove extern declarations from .cpp files and if necessaryconvert all function definitions to C++ function definition syntax. Replace calls of malloc()and free() with new and delete. Remove unnecessary casts.[6] ( ∗2) Modify the result of §X.13[5] by eliminating arrays and ”naked” news and deletes.Hint: vector and array.[7] ( ∗2) Implement ssort() (§12.5) using a more efficient sorting algorithm. Hint: sort() andqsort().[8] ( ∗2.5) Consider :COVER ALL  QUESTIONS Computer Science Engineering & Technology C++ Programming FISICA 123A Share QuestionEmailCopy link Comments (0)