Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using Visual Community Studio 2022 and there are few errors. Please insert of examples as well for me to understand more clearly as well. Thank

using Visual Community Studio 2022 and there are few errors. Please insert of examples as well for me to understand more clearly as well. Thank you.

The code:

#include

using namespace std; int quality_point(int grade[], int credit[], int num) { int quality = 0; for (int i = 1; i <= num; i++) { quality = quality + (grade[i] * credit[i]); } return quality; } float gpa(int x, int credit[], int num) { float gpa; float creditsum = 0; for (int i = 1; i <= num; i++) { creditsum = creditsum + credit[i]; } gpa = x / creditsum; return gpa; }

What problems were encountered by database developers before Codd introduced the Relational Model? [1 mark] (ii) Describe the basic elements of the Model, and explain what is meant by a relational schema. [4 marks] (iii) Explain how a formal schema can assist both the application database designer and a database application programmer. What if any are the disadvantages of adopting a mathematical description of database structure? [5 marks] (b) In 1976 Peter Chen introduced the Entity Relationship (E-R) Model to support a more natural description of real world data. (i) Describe the basic elements of the Model, and explain some of the choices available to the database designer. [4 marks] (ii) Explain what is meant by a foreign key in the relational model. How could you use foreign keys to represent a database described by an E-R model in relational form? To what extent are the two approaches to data modelling complementary? [6 marks]

A software module controls a car park of known capacity. () and exit() are triggered when cars enter and leave via the barriers. Give pseudocode for the enter and exit procedures (i) if the module is a monitor [8 marks] (ii) if the programming language in which the module is written provides only semaphores [4 marks] (b) Outline the implementation of (i) semaphores [4 marks] (ii) monitors [4 marks]

In a proposed, next-generation banking system a number of transactions are to be scheduled to run concurrently: Debit (D) transactions to make payments from customer accounts to a credit card company. Interest (I) transactions to add daily interest to customer account balances. Transfer (T) transactions which first check whether the source account contains sufficient funds then either abort or continue the transfer from source to destination accounts. Customer x is running a T to transfer 1000 from A to B. Customer y is running a T to transfer 200 from B to A. (a) Discuss the potential for interference between any of these transactions. [7 marks] (b) Demonstrate the effect of concurrency control based on strict two-phase locking in relation to the discussion in (a). [8 marks] (c) Comment on the scope of concurrency control in relation to the discussion in (a). [5 marks] [Hint: you may assume that operations on bank account objects, such as debit, credit and add-interest are atomic.]

You are asked to write Prolog program to work with binary trees. Your code should not rely on any library predicates and you should assume that the interpreter is running without occurs checking. (a) Describe a data representation scheme for such trees in Prolog and demonstrate it by encoding the tree shown above. [3 marks] (b) Implement a Prolog predicate bfs/2 which effects a breadth-first traversal of a tree passed as the first argument and unifies the resulting list with its second argument. For example, when given the tree shown above as the first argument the predicate should unify the second argument with the list [3,2,7,4,2,5]. [4 marks] (c) Explain why the bfs/2 predicate might benefit from being converted to use difference lists. [2 marks] (d) Implement a new predicate diffbfs/2 which makes use of a difference list to exploit the benefit you identified in part (c). Your predicate should take the same arguments as bfs/2. [6 marks] (e) A friend observes that a clause in diffbfs/2 will need to contain an empty difference list and proposes two possible ways of representing it, either []-[] or A-A. Consider your implementation of diffbfs/2. For each use of an empty difference list, justify your choice and explain what can go wrong using the alternative form. [2 marks... [5:13 PM, 4/26/2022] Dr. Tee: Question: Suppose that R(A, B, C) is a relational schema with functional dependencies F = {A, B C, C B}. (i) Is this schema in 3NF? Explain. [2 marks] (ii) Is this schema in BCNF? Explain. [2 marks] (b) Decomposition plays an important role in database design. (i) Define what is meant by a lossless-join decomposition. [2 marks] (ii) Define what is meant by a dependency preserving decomposition. [2 marks] (c) Let R(A, B, C, D, E) be a relational schema with the following functional dependencies i) What is the closure of {A, B}? [2 marks] (ii) What is the closure of {B, E}? [2 marks] (iii) Decompose the schema to BCNF in two different ways. In each case, are all dependencies preserved? Explain. [4 + 4 marks]

For a transaction model based on objects and object operation time-stamps: (a) (i) Define how conflict may be specified in terms of object operation semantics. (ii) Give an example of conflicting operations. (iii) Give an example of non-conflicting operations that would be defined as conflicting under read-write semantics. [3 marks] (b) Define the necessary and sufficient condition for two transactions to be serialisable. Give an example of a non-serialisable execution of a pair of transactions. [3 marks] (c) Define the necessary and sufficient condition for any number of transactions to be serialisable. [1 mark] (d) Discuss how the following methods of providing concurrency control in database systems enforce the properties defined above. (i) Strict two-phase locking. [4 marks] (ii) Strict timestamp ordering. [4 marks] (iii) Optimistic concurrency control. [5 marks]

) In the context of virtual memory management: implemented? [4 marks] (ii) What is meant by temporal locality of reference? [2 marks] (iii) How does the assumption of temporal locality of reference influence page replacement decisions? Illustrate your answer by briefly describing an appropriate page replacement algorithm or algorithms. [3 marks] (iv) What is meant by spatial locality of reference? [2 marks] (v) In what ways does the assumption of spatial locality of reference influence the design of the virtual memory system? [3 marks] (b) Buses are used to connect devices to the processor. (i) Describe with the aid of a diagram the operation of a synchronous bus. [4 marks] (ii) In what ways does an asynchronous bus differ? [2 marks

Consider an operating system that uses hardware support for paging to provide virtual memory to applications. (a) (i) Explain how the hardware and operating system support for paging combine to prevent one process from accessing another's memory. [3 marks] (ii) Explain how space and time overheads arise from use of paging, and how the Translation Lookaside Buffer (TLB) mitigates the time overheads. [3 marks] (b) Consider a system with a five level page table where each level in the page table is indexed by 9 bits and pages are 4 kB in size. A TLB is provided that is indexed by the first 57 bits of the address provided by the process, and achieves a 90% hit rate. A main memory access takes 40 ns while an access to the TLB takes 10 ns. The maximum memory read bandwidth is 100 GB/s. (i) What is the effective memory access latency? [4 marks] (ii) A colleague suggests replacing the system above with one that provides 80 GB/s memory read bandwidth and main memory access latency of 30 ns. Explain whether you should accept the replacement or not, and why. [4 marks] (c) A creative engineer suggests structuring the TLB so that not all the bits of the presented address need match to result in a hit. Suggest how this might be achieved, and what might be the costs and benefits of doing so. [6 marks]

(a) Describe two quantitative and two qualitative techniques for analysing the usability of a software product. [4 marks] (b) Compare the costs and benefits of the quantitative techniques. [6 marks] (c) Compare the costs and benefits of the qualitative techniques. [6 marks] (d) If restricted to a single one of these techniques when designing a new online banking system, which would you choose and why?

(a) Suppose that women who live beyond the age of 80 outnumber men in the same age group by three to one. How much information, in bits, is gained by learning that a person who lives beyond 80 is male? [2 marks] (b) Consider n discrete random variables, named X1, X2, . . . , Xn, of which Xi has entropy H(Xi), the largest being H(XL). What is the upper bound on the joint entropy H(X1, X2, . . . , Xn) of all these random variables, and under what condition will this upper bound be reached? What is the lower bound on the joint entropy H(X1, X2, . . . , Xn)? [3 marks] (c) If discrete symbols from an alphabet S having entropy H(S) are encoded into blocks of length n symbols, we derive a new alphabet of symbol blocks S n . If the occurrence of symbols is independent, then what is the entropy H(S n ) of this new alphabet of symbol blocks? [2 marks] (d) Consider an asymmetric communication channel whose input source is the binary alphabet X = {0, 1} with probabilities {0.5, 0.5} and whose outputs Y are also this binary alphabet {0, 1}, but with asymmetric error probabilities. Thus an input 0 is flipped with probability , but an input 1 is flipped with probability , giving this channel matrix p (i) Give the probabilities of both outputs, p(Y = 0) and p(Y = 1). [2 marks] (ii) Give all the values of (, ) that would maximise the capacity of this channel, and state what that capacity then would be. [3 marks] (iii) Give all the values of (, ) that would minimise the capacity of this channel, and state what that capacity then would be. [3 marks] (e) In order for a variable length code having N codewords with bit lengths 1 mark] (f ) The information in continuous signals which are strictly bandlimited (lowpass or bandpass) is quantised, in that such continuous signals can be completely represented by a finite set of discrete samples. Describe two theorems about how discrete samples suffice for exact reconstruction of continuous bandlimited signals, even at all the points between the sampled values. [4 mark

(a) A two state Markov process emits the letters {A, B, C, D, E} with the probabilities shown for each state. Changes of state can occur when some of the symbols are generated, as indicated by the arrows. 4.2 Information sources with memory We will wish to consider sources with memory, so we also consider Markov processes. Our four event process (a symbol is generated on each edge) is shown graphically together with a two state Markov process for the alphabet fA, B, C, D, Eg in gure 17. We can then solve for the state occupancy using ow equations (this example is trivial).

ess with states fS 1; S2; : : :Sng, with transition probabilities pi(j) being the probability of moving from state Si to state Sj (with the emission of some symbol). First we can dene the entropy of each state in the normal manner: Hi = X j pi(j) log2 pi(j) and then the entropy of the system to be the sum of these individual state entropy values weighted with the state occupancy (calculated from the ow equations):

Pipi(j) log pi(j) (45) Clearly for a single state, we have the entropy of the memoryless source. 4.3 The Source Coding theorem Often we wish to eciently represent the symbols generated by some source. We shall consider encoding the symbols as binary digits. 19 (i) What are the state occupancy probabilities? [1 mark] (ii) What is the probability of the letter string AD being emitted? [1 mark] (iii) What is the entropy of State 1, what is the entropy of State 2, and what is the overall entropy of this symbol generating process? [5 marks] (b) A fair coin is secretly flipped until the first head occurs. Let X denote the number of flips required. The flipper will truthfully answer any "yes-no" questions about his experiment, and we wish to discover thereby the value of X as efficiently as possible. (i) What is the most efficient possible sequence of such questions? Justify your answer. [2 marks] (ii) On average, how many questions should we need to ask? Justify your answer. [2 marks] (iii) Relate the sequence of questions to the bits in a uniquely decodable prefix code for X. [1 mark] (c) Define complex Gabor wavelets, restricting yourself to one-dimensional functions if you wish, and list four key properties that make such wavelets useful for encoding and compressing information, as well as for pattern recognition. Explain how their self-Fourier property and their closure under multiplication (i.e. the product of any two of them is yet again a Gabor wavelet) gives them also closure under convolution. Mention one disadvantage of such wavelets for reconstructing data from their projection coefficients. [8 mark int main() { int num; cout << "Enter Number of subjects taken by students :"; cin >> num; int grade[num + 1]; int credit[num + 1]; cout << "Enter Grade of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Grade " << i << ":"; cin >> grade[i]; } cout << "Enter credits of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Credit " << i << ":"; cin >> credit[i]; }

int x = quality_point(grade, credit, num); float z = gpa(x, credit, num);

cout << "GPA of student for semester is: " << z;

return 0; }

I am using Visual Community Studio 2022 and there are few errors. Please insert of examples as well for me to understand more clearly as well. Thank you.

The code:

#include

using namespace std; int quality_point(int grade[], int credit[], int num) { int quality = 0; for (int i = 1; i <= num; i++) { quality = quality + (grade[i] * credit[i]); } return quality; } float gpa(int x, int credit[], int num) { float gpa; float creditsum = 0; for (int i = 1; i <= num; i++) { creditsum = creditsum + credit[i]; } gpa = x / creditsum; return gpa; }

int main() { int num; cout << "Enter Number of subjects taken by students :"; cin >> num; int grade[num + 1]; int credit[num + 1]; cout << "Enter Grade of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Grade " << i << ":"; cin >> grade[i]; } cout << "Enter credits of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Credit " << i << ":"; cin >> credit[i]; }

int x = quality_point(grade, credit, num); float z = gpa(x, credit, num);

cout << "GPA of student for semester is: " << z;

return 0; }

This are the error:

1. expression must have a constant value. Line : 27 and 28

2. expression did not evaluate to constant. Line : 27 and 28

3. ' >> ' result of expression not used . Line : 32 and 37

This are the error:

1. expression must have a constant value. Line : 27 and 28

2. expression did not evaluate to constant. Line : 27 and 28

3. ' >> ' result of expression not used . Line : 32 and 37I am using Visual Community Studio 2022 and there are few errors. Please insert of examples as well for me to understand more clearly as well. Thank you.

The code:

#include

using namespace std; int quality_point(int grade[], int credit[], int num) { int quality = 0; for (int i = 1; i <= num; i++) { quality = quality + (grade[i] * credit[i]); } return quality; } float gpa(int x, int credit[], int num) { float gpa; float creditsum = 0; for (int i = 1; i <= num; i++) { creditsum = creditsum + credit[i]; } gpa = x / creditsum; return gpa; }

int main() { int num; cout << "Enter Number of subjects taken by students :"; cin >> num; int grade[num + 1]; int credit[num + 1]; cout << "Enter Grade of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Grade " << i << ":"; cin >> grade[i]; } cout << "Enter credits of subjects: " << endl; for (int i = 1; i <= num; i++) { cout << "Subject Credit " << i << ":"; cin >> credit[i]; }

int x = quality_point(grade, credit, num); float z = gpa(x, credit, num);

cout << "GPA of student for semester is: " << z;

return 0; }

This are the error:

1. expression must have a constant value. Line : 27 and 28

2. expression did not evaluate to constant. Line : 27 and 28

3. ' >> ' result of expression not used . Line : 32 and 37

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

Data Communications and Networking

Authors: Behrouz A. Forouzan

5th edition

73376221, 978-0073376226

More Books

Students also viewed these Computer Network questions

Question

Please help me evaluate this integral. 8 2 2 v - v

Answered: 1 week ago

Question

Why is UDP needed? Why cant a user program directly access IP?

Answered: 1 week ago