Provide solution to the following programming questionS. Software systems often incorporate structural representations of the application domain
Question:
Provide solution to the following programming questionS. Software systems often incorporate structural representations of the application domain in which they operate. For example, a vehicle control system should be aware of the fact that the car has precisely four wheels. This kind of information must be captured, encoded and tested at each stage of the software design process. Using the number of wheels in a car as a simple example, describe relevant design activities and products at each of the following phases of a software project: (a) inception; [4 marks] (b) elaboration; [4 marks] (c) construction; [4 marks] (d) transition; [4 marks] (e) system operation. [4 marks] 8 Regular Languages and Finite Automata (a) Explain what is a context-free grammar and the language it generates. [4 marks] (b) What does it mean for a context-free grammar to be regular? Given any deterministic finite automaton M, describe a regular context-free grammar that generates the language of strings accepted by M. [4 marks] (c) Construct a non-deterministic finite automaton with -transitions whose language of accepted strings is equal to the language over the alphabet {a, b, c} generated by the context-free grammar with non-terminals q0 and q1, whose start symbol is q0 and whose productions are q0 abq1, q1 , q1 q0 and q1 abc. [4 marks] (d) Is every language generated by a context-free grammar equal to the set of strings accepted by some non-deterministic finite automaton with -transitions? Justify your answer. (Any standard results about regular languages you use should be carefully stated, but need not be proved.) [8 marks](a) Suppose that X is a random variable whose value r is distributed Geometric(p). Write down the expression for the probability P(X = r). [3 marks] (b) By using a suitable generating function or otherwise, show that the expectation E(X) = (1 p)/p. [5 marks] The University Computing Service define a serious power outage as a power cut that lasts for longer than their Uninterruptable Power Supply equipment can maintain power. During the course of an academical year the number of serious power outages is a random variable whose value is distributed Geometric(2/5). Accordingly, the probability of having no serious power outages during the course of a year is 2/5. (c) The University is investigating a compensation scheme which would make no payment over the year if the number of serious power outages were zero or one but which would pay the Computing Service 1000 for every such outage (including the first) if the total number of serious power outages in a year were two or more. Determine the expected annual sum that the Computing Service would receive. [8 marks] (d) To what value would the parameter of the Geometric Distribution have to be changed (from 2/5) for the expected annual sum to be 750? [4 marks] 6 Probability (a) Give a brief account of the Trinomial Distribution and include in your explanation an expression that is equivalent to n! r!(nr)! p r q nr for the Binomial Distribution. [5 marks] (b) An indicator light can be in one of three states: OFF, FLASHING and ON, with probabilities 1/2, 2/5 and 1/10 respectively. A test panel has five such lights whose states are mutually independent. (i) What is the probability that all five lights are OFF? [3 marks] (ii) What is the probability that three lights are OFF, one light is FLASHING and one light is ON? [3 marks] (iii) What is the probability that three or more lights are OFF and at most one is ON? [9 marks] All results must be expressed as fractions.
Some of the computers are free (no one logged in), and some others are occupied by students. In the implementation, you will define a Lab array (an array of string.Rointers) in the stack memory. This pointer array can be local to the main function or it can be a global. And each pointer in the array will point to a string array that is dynamically allocated from the heap memory. (Size of each array is given above) Initially, all computers in all labs will be set to "Free" state. Then you will provide a menu to the user such as 1) Print the current status of computers in all labs 2) Log in a new student to a computer in a lab a. Ask user name, the lab number, and the computer number. If it is available, log that student in. 3) Log outa student from his/her computer in a lab Ask user the lab number and the computer number. If the computer is occupied, log that student out. . 4) Exit 5) (Bonus Option +20 Points) Add N new computers to a lab. Note: Here you will ask user the lab number and the how many new computers (N) to add. Then you will add those computers to the lab without losing the current content (logged in students). (Tig: You will allocate a new array space (with N more elements) from the heap, then move the content of the old array to the new array. Finally, you will send the address of the new array to corresponding lab pointer. All new elements (computers) will be set to "Free" state.
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley