GATE-CS-2004

Last Updated :
Discuss
Comments

Question 1

Consider two processes P1 and P2 accessing the shared variables X and Y protected by two binary semaphores SX and SY respectively, both initialized to 1. P and V denote the usual semaphore operators, where P decrements the semaphore value, and V increments the semaphore value. The pseudo-code of P1 and P2 is as follows : P1 :

 While true do {
L1 : ................
L2 : ................
X = X + 1;
Y = Y - 1;
V(SX);
V(SY);
}

P2 :

 While true do {
L3 : ................
L4 : ................
Y = Y + 1;
X = Y - 1;
V(SY);
V(SX);
}

In order to avoid deadlock, the correct operators at L1, L2, L3 and L4 are respectively

  • P(SY), P(SX); P(SX), P(SY)

  • P(SX), P(SY); P(SY), P(SX)

  • P(SX), P(SX); P(SY), P(SY)

  • P(SX), P(SY); P(SX), P(SY)

Question 2

A and B are the only two stations on an Ethernet. Each has a steady queue of frames to send. Both A and B attempt to transmit a frame, collide, and A wins the first backoff race. At the end of this successful transmission by A, both A and B attempt to transmit and collide. The probability that A wins the second backoff race is:

  • 0.5

  • 0.625

  • 0.75

  • 1.0

Question 3

How many 8-bit characters can be transmitted per second over a 9600 baud serial communication link using asynchronous mode of transmission with one start bit, eight data bits, two stop bits, and one parity bit ?

  • 600

  • 800

  • 876

  • 1200

Question 4

Assume that the operators +, -, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix expression a + b × c - d ^ e ^ f is

  • abc × + def ^ ^ -

  • abc × + de ^ f ^ -

  • ab + c × d - e ^ f ^

  • - + a × bc ^ ^ def

Question 5

The recurrence equation

T(1) = 1
T(n) = 2T(n - 1) + n, n ≥ 2 

evaluates to

a). 2n + 1 - n - 2
b). 2n - n
c). 2n + 1 - 2n - 2
d. 2n + n

  • a

  • b

  • c

  • d

Question 6

Let A[1, ..., n] be an array storing a bit (1 or 0) at each location, and f(m) is a function whose time complexity is θ(m). Consider the following program fragment written in a C like language:

C
counter = 0;
for (i = 1; i < = n; i++)
{ 
      if (A[i] == 1) 
         counter++;
      else {
         f(counter); 
         counter = 0;
      }
}

The complexity of this program fragment is

  • Ω(n2)

  • Ω(nlog n) and O(n2)

  • θ(n)

  • O(n)

Question 7

Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major or column-major order in contiguous memory locations. The time complexity of an algorithm to compute M1 × M2 will be

  • best if A is in row-major, and B is in column- major order

  • best if both are in row-major order

  • best if both are in column-major order

  • independent of the storage scheme

Question 8

Consider a system with a two-level paging scheme in which a regular memory access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds. An average instruction takes 100 nanoseconds of CPU time, and two memory accesses. The TLB hit ratio is 90%, and the page fault rate is one in every 10,000 instructions. What is the effective average instruction execution time?

  • 645 nanoseconds

  • 1050 nanoseconds

  • 1215 nanoseconds

  • 1230 nanoseconds

Question 9

The minimum number of page frames that must be allocated to a running process in a virtual memory environment is determined by

  • the instruction set architecture

  • page size

  • physical memory size

  • number of processes in memory

Question 10

Consider the following C function

C
void swap (int a, int b)
{
   int temp;
   temp = a;
   a = b;
   b = temp;
}

In order to exchange the values of two variables x and y.

  • Call swap (x, y)

  • Call swap (&x, &y)

  • swap(x,y) cannot be used as it does not return any value

  • swap(x,y) cannot be used as the parameters are passed by value

Tags:

There are 90 questions to complete.

Take a part in the ongoing discussion