GATE-CS-2016 (Set 2) (original) (raw)

Consider the following two-process synchronization solution.

**Process 0 **Process 1

Entry: loop while (turn == 1); Entry: loop while (turn == 0);
(critical section) (critical section)
Exit: turn = 1; Exit turn = 0;

The shared variable turn is initialized to zero. Which one of the following is TRUE?

Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked is ________.

In an Ethernet local area network, which one of the following statements is TRUE ?

Consider a 128×103 bits/second satellite communication link with one-way propagation delay of 150 milliseconds. Selective retransmission (repeat) protocol is used on this link to send data with a frame size of 1 kilobyte. Neglect the transmission time of acknowledgment. The minimum number of bits required for the sequence number field to achieve 100% utilization is ___________

A network has a data transmission bandwidth of 20 × 106 bits per second. It uses CSMA/CD in the MAC layer. The maximum signal propagation time from one node to another node is 40 microseconds. The minimum size of a frame in the network is _________ bytes.
Note : This question was asked as Numerical Answer Type.

Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following is TRUE?

I. Quicksort runs in Θ(n2) time

II. Bubblesort runs in Θ(n2) time

III. Mergesort runs in Θ(n) time

IV. Insertion sort runs in Θ(n) time

Let A1, A2, A3, and A4 be four matrices of dimensions 10 x 5, 5 x 20, 20 x 10, and 10 x 5, respectively. The minimum number of scalar multiplications required to find the product A1A2A3A4 using the basic matrix multiplication method is

The value printed by the following program is

C `

void f(int* p, int m) { m = m + 5; *p = *p + m; return; } void main() { int i=5, j=10; f(&i, j); printf("%d", i+j); }

`

In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?

Consider the following program:

C `

int f(int *p, int n) { if (n <= 1) return 0; else return max(f(p+1,n-1),p[0]-p[1]); } int main() { int a[] = {3,5,2,6,4}; printf("%d", f(a,5)); }

`

Note: max(x,y) returns the maximum of x and y. The value printed by this program is

There are 65 questions to complete.

Take a part in the ongoing discussion