question archive (a) Many distributed systems make use of replication
Subject:Computer SciencePrice:9.82 Bought3
(a) Many distributed systems make use of replication.
(i) Give two advantages and one disadvantage of using replication.
(ii) Distinguish weak consistency and strong consistency. What is the primary
disadvantage of using the latter?
(iii) Describe how to commit a transaction in a distributed transaction
processing system in which objects are replicated on different servers.
(b) Group communication can be achieved via ordered multicast. Describe how you
would build an ordered multicast system which preserves causal ordering.
[6 marks]
(c) You are part of a team tasked with building a distributed filing system. One of
the requirements is that it must be possible to revoke access rights to a file within
T milliseconds (T ≥ 0). Describe how you could achieve this, commenting on
how the value of T would influence your decision.
provide answers to all questions
(a) What are the main criteria to be considered in the design of a line drawing
algorithm for a raster graphics display? [2 marks]
(b) Describe an algorithm to fill a series of pixels running from (x0, y0) to (x1, y1)
that meets these criteria, explaining why it does so. Answers should consist of
more than a fragment of pseudo-code. [6 marks]
(c) A new volumetric display stores an image as a three-dimensional array of
volume elements or voxels. Reformulate the design and implementation of
the line-drawing algorithm to fill a series of voxels running from (x0, y0, z0) to
(x1, y1, z1). [6 marks]
(d) How would this line-drawing algorithm be used to draw B´ezier curves in three
dimensions?
(a) Describe how transform coding can be used to compress image data. [4 marks]
(b) Explain the Walsh-Hadamard transform on a one-dimensional array of 4
greyscale values. [4 marks]
(c) Extend this to the Walsh transform for a two-dimensional array of 2×2 greyscale
values. [4 marks]
(d) Develop an analogous transform for a three-dimensional array of 2 × 2 × 2
greyscale values. [8 marks]
Include sufficient algebra in your answers to allow a competent programmer to
implement the algorithm.
This question explores Heath's Rule, which states that if R(X, Y, Z) satisfies the
functional dependency X → Y , where X, Y , and Z are disjoint non-empty sets of
attributes, then
R = πX,Y (R) ./X πX,Z(R),
where ./X is the natural join on the attributes of X.
(a) What is meant by the functional dependency X → Y ? [2 marks]
(b) Define the natural join operation ./X. [2 marks]
(c) Suppose that the functional dependency X → Y holds and we use Heath's rule
to justify replacing the schema R(X, Y, Z) with R1(X, Y ) and R2(X, Z).
(i) Give two possible advantages for this schema change. [2 marks]
(ii) Give two possible disadvantages for this schema change. [2 marks]
(iii) Is X a key for R1? Explain. [2 marks]
(iv) Is X a key for R2? Explain. [2 marks]
(d) Prove that Heath's Rule always holds.
(a) Codd's 1970 paper introduced the Relational Model of data to address the
difficulties of building database applications using the technology that was
available at the time.
(i) 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?
(a) What are the differences and similarities between a branch, a software exception
(SYSCALL on MIPS, SWI on ARM), an exception and an interrupt?
[6 marks]
(b) What is the difference between precise and imprecise exceptions? [4 marks]
(c) What does a TLB do and how does it do it? [5 marks]
(d) TLB misses can be handled in hardware or software. If misses are handled purely
in software, how are they made transparent to the user code?
(a) In a data-center context, describe a straggler using two examples. [2 marks]
(b) (i) Describe the TCP incast problem. [2 marks]
(ii) Outline and critique a solution to the TCP incast problem. [3 marks]
(c) (i) Show that to achieve a steady-state throughput of 10 Gbps, a TCP session
with a Round-Trip-Time (RTT) of 100 ms and a Maximum-Segment-Size
(MSS) of 1500 bytes can tolerate a packet loss probability of less than
2 × 10−10. [4 marks]
(ii) Compute the potential packet-memory requirement of either end-system
implementing Selective-Acknowledgements (SACK). [3 marks]
(iii) What is the tolerable packet loss probability if this same network (same
MSS and RTT) operated at 100 Gbps? [2 marks]
(d) Some experts say: "Many TCP transactions in the Internet never enter
congestion-avoidance." Discuss this claim.
[Hint: It has been measured that greater than 90% of web objects are less than
10 Kbytes.] [4 marks]
6
(a) (i) Define the terms capacity and latency as applied to communication
channels; explaining whether there is a strict relationship between the
capacity of a channel and its latency. [3 marks]
(ii) Using a clear example explain how the latency of a channel can have a
direct effect on the capacity of a higher-layer channel which uses it.
[8 marks]
(iii) Describe how the capacity of the higher-layer channel may be improved,
without any change to the characteristics of the underlying channel.
[3 marks]
(iv) Describe in what circumstances such changes would provide only limited
benefit. [2 marks]
(b) The figure below illustrates, for a single TCP connection, changes in the
advertised congestion window (CWND).
!"#$%&'"#()*#+",(
-!)./0(
1*2%(
!" #" $" %" &" '" ("
(i) Indicate which phase of congestion control the TCP connection is in at G.
(ii) Indicate which phase of congestion control the TCP connection is in at E.
(iii) Describe the event that has occurred at D.
(iv) Describe the event that has occurred at F.
(a) Consider the host mine.ja.net, with a local DNS server dns1.ja.net.
[Note: dns1.ja.net is configured to use recursive DNS by default.]
(i) Host mine.ja.net asks server dns1.ja.net to resolve the hostname
yours.foobar.com. Assume there are no cached entries relevant to this
request. Write down the steps taken to resolve yours.foobar.com and
respond to mine.ja.net. [4 marks]
(ii) Describe the differences between this solution and one achieved using
iterative DNS. [2 marks]
(iii) Compare and contrast DNS with ARP. [4 marks]
(b) An office has an (Internet) access link rated at 10 Mbps full-duplex. Each user
requires 1 Mbps when transmitting and each user is active 10% of the time.
(i) Initially a static allocation of bandwidth is made for each user. How many
users can the access link support? [1 mark]
(ii) The office opts for a pure packet-switched access link. What is the
probability that a given user is transmitting? [1 mark]
(iii) The office supports 35 users on the packet-switched access link. What is
the probability that exactly n users are transmitting simultaneously?
[2 marks]
(iv) Find the probability that there are 11 or more users transmitting
simultaneously. [3 marks]
(v) Describe an assumption about the nature of the traffic that underlies the
answer to part (b)(iv) and give two examples of network traffic where this
assumption is not valid.
n a program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume that the array contains integers. The function should display all of the numbers in the array that are greater than the numbern.
Write program that takes n number of elements from user (where, n is specified by user), stores data in an array and calculates the average of those numbers.
Write program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful.
In the previous Python assignment, you for the Guess a Number game, perhaps with a function that compared each guess to the randomly generated target number.(The previous python assignment was :
script must generate a random number between 1 and 20 and ask the user to guess the number, telling them what numbers the random number falls within. Give the user 6 tries. Running my script, it looks like this:
Hello! What is your name? Jim
Your solution should include a function that takes two parameters, the number to be guessed and the number that was guessed and returns:). I have no problem with my script.
I would like to get answers for the below questions.
What kind of tests would you run on this program? For what would you test?
What testing partitions would be appropriate for testing the function comparing guesses to the target number?
What testing of ATM software would be analogous to the tests and partitions used for your Guess a Number game?
As you have probably recognized by now, computer systems and applications are all about data. Data
is always introduced to the system or application at some point as input. Data input is traditionally
accomplished by using a keyboard or mouse, but it is important to be aware there are many other
ways to obtain data input.
Computer applications can also obtain data input by "pulling" it from some other source (other than a
human/end-user). This source can be local (on the same machine) or remote (using the internet).
There are many methods available to "pull" data and you will be learning about these in the coming
semesters. The most common however, involve files, databases, and web-services.
Another widely used method of data input is through the use of scanners. These are often used in
retail stores to scan barcodes for easy data entry. Use of this type of technology is extremely efficient
when compared to a manual human method of input - especially if you can use this technology
automatically without even human intervention.
This workshop is an introduction to using more modern methods of data input and to integrate it into
your solutions which ultimately add more efficiencies to daily business processes.
Workshop Details
A car wash business is looking for a system that will further automate their daily redundancies - more
specifically, the processing of customers who line-up for a car wash.
To address most of the inefficiencies and costs, the operation has decided to use a fully automated
computer kiosk approach (similar to a drive-through) which will eliminate the need for a cashier to
manually process each customer car wash request and payment. Regular customers can simply drive
up to the kiosk, select a wash option, make payment, and proceed to get the car washed.
The new approach in processing customer transactions has opened an opportunity to offer monthly
VIP memberships that permits up to 2 washes per day at a reduced cost.
Note: The process of signing up for VIP membership is not done through the kiosk
system and therefore does not have to be addressed in this workshop.
VIP members will have a stick-on chip affixed to their vehicle windshield. Vehicles approaching the
kiosk station are automatically scanned by the system and if a stick-on chip is successfully detected and
read, VIP members can be identified including their individual contracted wash tier option.
VIP members have the option to override the wash-tier they signed up for (applies only to that one
wash and does not affect their subscription agreement). If a VIP customer chooses a different washtier from their agreement, regular rates will be charged for the selected wash-tier (even if it is a less
expensive tier).
Note: If a VIP member wants more than 2 washes on the same day, the customer
will have to pay regular rates.
You do not have to describe the details of the receipt, but a receipt should be generated.
Your Tasks
1. Define the solution for processing a car wash customer using the new computer kiosk
(should be able to handle both, a regular customer and a VIP member).
2. Communicate the solution using pseudo code and a flowchart
3. Presenters will prepare a video that will present the problem and solution in non-technical
terms and will argue that this is an excellent solution to the problem.
[Logic 1] Define the logic for a regular person who pays cash and gets a car wash as pseudo code or a
flowchart.
[Logic 2] Define the logic for a VIP who wants to get the tier they paid for.
Car Wash Options
Tier-1 "Clean" $ 6.00
Tier-2 "Sparkling" $11.00
Tier-3 "The Works" $20.00
[Logic 3] Define the logic for a VIP who wants to upgrade their tier or is washing more than twice in
one day.
(a) What is the relationship between critical sections and mutual exclusion?
[2 marks]
(b) Describe how mutual exclusion can be achieved using:
(i) Spinlocks [2 marks]
(ii) Semaphores [2 marks]
(iii) Event Counts and Sequencers [2 marks]
(c) Describe the operation of a monitor. Be sure to explain how it supports mutual
exclusion and condition synchronization. [6 marks]
(d) Why are monitors used in preference to conditional critical regions? [2 marks]
(e) In an effort to promote diversity, the Master of Holy Rock College, Cambridge,
decides that the JCR must always hold at least one state school educated (SSE)
student for every three public school educated (PSE) students. Reasoning that
students are not very dissimilar from threads, he suggests the following entry
and exit routines be followed:
JCR = new Semaphore(0);
/* for SSE threads */ /* for PSE threads */
enterRoom() { enterRoom() {
signal(JCR, 3); wait(JCR);
} }
leaveRoom() { leaveRoom() {
wait(JCR); signal(JCR, 1);
wait(JCR); }
wait(JCR);
}
We can assume that undergraduates are smart enough not to try and enter the
JCR when it is full. Yet despite this, the Master's solution does not work quite
as hoped! Describe what can go wrong, and suggest a fix.
(a) In the context of concurrent systems, what is a transaction? [1 mark]
(b) Describe the ACID properties of transactions. [4 marks]
(c) Compare and contrast strict and non-strict isolation. [2 marks]
(d) For each of the following, describe how it can be used to provide isolation and/or
strict isolation:
(i) 2-Phase Locking (2PL) [3 marks]
(ii) Time-Stamp Ordering (TSO) [3 marks]
(iii) Optimistic Concurrency Control (OCC) [3 marks]
(e) A researcher suggests an isolation scheme that works as follows:
(i) Every object o has an associated version number, V (o).
(ii) When executing, a transaction reads a copy of any object it wishes to access,
and remembers the version number.
(iii) If the transaction wishes to modify an object, it modifies the copy rather
than the original.
(iv) When complete, the transaction checks the versions of all objects it has
modified; if any are different, it aborts; otherwise it writes back the new
versions of all objects, incrementing their version numbers, and commits.
(a) Explain what economists mean by a lemons market.
(b) What is the difference between hidden information and hidden action? Give
examples of each.
(c) Your company is about to launch a new anti-malware product for use on Android
devices. To blunt possible competition from low-cost, low-quality vendors you
decide you need to offer prospective customers some kind of assurance. Discuss
the advantages and disadvantages of the following options.
(i) You form a trade association with several other anti-malware firms and
promote a quality assurance mark, perhaps with assistance from the
government.
(ii) You approach the UK banks with a proposal that they certify your product
for use along with their banking app products, in the sense that a customer
using your system will have exercised due diligence. [4 marks]
(iii) You tell customers that if they are the victims of a scam that used malware
on their phone you will pay their legal bills.
(a) the function of a salt value in a password database [3 marks]
(b) two examples of covert channels in a file system protocol that is restricted to
read-only operations under a mandatory access-control policy [2 marks]
(c) three types of common software vulnerabilities, with examples [9 marks]
(d) two problems solved by Cipher Block Chaining
void fxn(int arr[], int size, int n)
{
int i;
// traverse the array
for( i = 0 ; i < size ; i++ )
cout<<arr[i]<<" ";
}
Step-by-step explanation
#include<stdio.h>
int main()
{
int a[100],n,i,k;
float avg,sum=0;
printf("Enter the number of data:");
scanf("%d", &n);
do
{
if(n>100)
{
printf("Error! number should be in range of 1-100: \n");
printf("Enter the number again: \n");
scanf("%d", &n);
}
else if(n<=100)
break;
}while(1);
k=n-1;
for(i=0;i<=k;i++)
{
printf("%d. Enter number:",i+1);
scanf("%d", &a[i]);
sum=sum+a[i];
}
avg=sum/n;
printf("Average of numbers is: %f \n", avg);
return(0);
}
#include <iostream>
#include <fstream>
using namespace std;
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
int findMin(int numbers[], int i, int minx, int n){
for (int j = i+1; j < n; j++)
if (numbers[j] < numbers[minx])
minx = j;
return minx;
}
void selectionSort(int numbers[], int n)
{
int i, j, minx;
for (i = 0; i < n-1; i++)
{
minx = i;
minx = findMin(numbers, i, minx, n);
swap(&numbers[minx], &numbers[i]);
}
}
int binarySearch(int numbers[], int l, int r, int x)
{
if (r >= l)
{
int mid = l + (r - l)/2;
if (numbers[mid] == x)
return mid;
if (numbers[mid] > x)
return binarySearch(numbers, l, mid-1, x);
return binarySearch(numbers, mid+1, r, x);
}
return -1;
}
int median(int numbers[], int n){
int m = 0;
if ((n % 2) == 0)
m = (numbers[n/2] + numbers[(n/2) - 1])/2.0;
else
m = numbers[n/2];
return m;
}
void showArray(int numbers[], int n){
for(int i = 0; i < n;i++)
cout << numbers[i] << " ";
}
int main()
{
int n;
fstream myfile("data.dat", ios_base::in);
int size = 50;
int a[size], i = 0;
while (myfile >> n)
{
a[i] = n;
i++;
}
selectionSort(a, size);
int result = binarySearch(a, 0, size-1, 7);
if(result == -1)
cout << "Number not found\n";
else
cout << "Number found at " << result << endl;
cout << "Median of the array is " << median(a, size) << endl;
showArray(a, size);
return 0;
}