GATE 2017 (Session 1)
64 questions
MCQ 44 · NAT 201-mark 30 · 2-mark 34
Questions 51–55 of 64
In a database system, unique time stamps are assigned to each transaction using Lamport's logical clock . Let TS() and TS() be the timestamps of transactions and respectively. Besides, holds a lock on the resource R, and has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
Assume any transactions that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?
if TS(T2) < TS(T1) then
T1 is killed
else T2 waits. Assume any transactions that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?
Answer: (A)
When the requester T2 is older (it has the smaller timestamp), the younger holder T1 is killed. Otherwise, the younger requester waits. So a transaction only waits for an older transaction. This means no cycle of waits can form the system is deadlock-free.
A killed transaction restarts with its old timestamp. Compared with new transactions, it keeps getting older, and in the end it becomes the oldest one. The oldest transaction is never killed the system is starvation-free.
Answer: both deadlock-free and starvation-free
A killed transaction restarts with its old timestamp. Compared with new transactions, it keeps getting older, and in the end it becomes the oldest one. The oldest transaction is never killed the system is starvation-free.
Answer: both deadlock-free and starvation-free
Consider the following grammar:
stmt if expr then expr else expr; stmt|
exprterm relop term|term
term id|number
ida|b|c
number [0-9]
where relop is a relational operator (e.g ,...), refers to the empty statement, and if ,then, else are terminals.
Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is ____________. For example the program
if then else
has 2 control flow paths and .
stmt if expr then expr else expr; stmt|
exprterm relop term|term
term id|number
ida|b|c
number [0-9]
where relop is a relational operator (e.g ,...), refers to the empty statement, and if ,then, else are terminals.
Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is ____________. For example the program
if then else
has 2 control flow paths and .
Answer: 1024
In the grammar, is or the empty statement. The and parts derive only , never , so an cannot sit inside another . The only is the one after the semicolon. So the program is a sequence of if-then-else statements, one after another, ending with the empty statement.
Each if-then-else has 2 paths ( or ), and the choice in one statement does not depend on the others. With ten terminals the paths multiply: .
Answer: 1024
Each if-then-else has 2 paths ( or ), and the choice in one statement does not depend on the others. With ten terminals the paths multiply: .
Answer: 1024
In a RSA cryptosystem a participant A uses two prime numbers p=13 and q=17 to generate her public and private keys. If the public key of A is 35. Then the private key of A is __________.
Answer: 11
and .
The public key is , and . The private key satisfies .
Use the extended Euclid method:
Going back: .
So and .
Check: .
Answer: 11
The public key is , and . The private key satisfies .
Use the extended Euclid method:
Going back: .
So and .
Check: .
Answer: 11
The values of parameters for the Stop-and-Wait ARQ protocol are as given below:
Bit rate of the transmission channel = 1Mbps
Propagation delay from sender to receiver = 0.75 ms
Time to process a frame = 0.25ms
Number of bytes in the information frame =1980
Number of bytes in the acknowledge frame = 20
Number of overhead bytes in the information frame = 20
Assume that there are no transmission errors. Then the transmission efficiency ( expressed in percentage) of the Stop-and - Wait ARQ protocol for the above parameters is _________( correct to 2 decimal places)
Bit rate of the transmission channel = 1Mbps
Propagation delay from sender to receiver = 0.75 ms
Time to process a frame = 0.25ms
Number of bytes in the information frame =1980
Number of bytes in the acknowledge frame = 20
Number of overhead bytes in the information frame = 20
Assume that there are no transmission errors. Then the transmission efficiency ( expressed in percentage) of the Stop-and - Wait ARQ protocol for the above parameters is _________( correct to 2 decimal places)
Answer: 86.5 to 89.5
Work through each part:
- Time to send the frame: 1980 8 / = 15.84 ms (the useful data is 1960 bytes, which takes 15.68 ms)
- Time to send the ACK: 20 8 / = 0.16 ms
- Propagation takes 0.75 ms in each direction. Processing takes 0.25 ms.
One full cycle = 15.84 + 0.75 + 0.25 + 0.16 + 0.75 = 17.75 ms
Efficiency = 15.68 / 17.75 88.34%
Answer: 88.34
- Time to send the frame: 1980 8 / = 15.84 ms (the useful data is 1960 bytes, which takes 15.68 ms)
- Time to send the ACK: 20 8 / = 0.16 ms
- Propagation takes 0.75 ms in each direction. Processing takes 0.25 ms.
One full cycle = 15.84 + 0.75 + 0.25 + 0.16 + 0.75 = 17.75 ms
Efficiency = 15.68 / 17.75 88.34%
Answer: 88.34
Consider a database that has the relation schema CR (StudentName, CourseName). An instance of the schema CR is as given below.
The following query is made on the database
The number of rows in T2 is ____________.
The following query is made on the database
The number of rows in T2 is ____________.
Answer: 4
T1 is the set of courses taken by SA, which is {CA, CB, CC}. T2 is the set of students who take all of these courses:
- SA: yes. SB: no, because there is no CA. SC: yes. SD: yes. SE: no, because there is no CC. SF: yes.
Answer: 4
- SA: yes. SB: no, because there is no CA. SC: yes. SD: yes. SE: no, because there is no CC. SF: yes.
Answer: 4