GATE-CS-2003

Last Updated :
Discuss
Comments

Question 1

Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.

Process P:
while (1) {
W:
print '0';
print '0';
X:
}

Process Q:
while (1) {
Y:
print '1';
print '1';
Z:
}

Synchronization statements can be inserted only at points W, X, Y and Z Which of the following will ensure that the output string never contains a substring of the form 01^n0 or 10^n1 where n is odd?

  • P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1

  • P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1

  • P(S) at W, V(S) at X, P(S) at Y, V(S) at Z, S initially 1

  • V(S) at W, V(T) at X, P(S) at Y, P(T) at Z, S and T initially 1

Question 2

Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.

Process P:
while (1) {
W:
print '0';
print '0';
X:
}

Process Q:
while (1) {
Y:
print '1';
print '1';
Z:
}

Synchronization statements can be inserted only at points W, X, Y and Z.

Which of the following will always lead to an output starting with '001100110011' ?

  • P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1

  • P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S initially 1, and T initially 0

  • P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1

  • P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S initially 1, and T initially 0

Question 3

A 2 km long broadcast LAN has 107 bps bandwidth and uses CSMA/CD. The signal travels along the wire at 2 × 108 m/s. What is the minimum packet size that can be used on this network?

  • 50 bytes

  • 100 bytes

  • 200 bytes

  • None of these

Question 4

Host A is sending data to host B over a full duplex link. A and B are using the sliding window protocol for flow control. The send and receive window sizes are 5 packets each. Data packets (sent only from A to B) are all 1000 bytes long and the transmission time for such a packet is 50 µs. Acknowledgement packets (sent only from B to A) are very small and require negligible transmission time. The propagation delay over the link is 200 us. What is the maximum achievable throughput in this communication?

  • A

  • B

  • C

  • D

Question 5

Consider the following three claims

1. (n + k)m = Θ(nm), where k and m are constants
2. 2n + 1 = O(2n)
3. 22n + 1 = O(2n)

Which of these claims are correct ?

  • 1 and 2

  • 1 and 3

  • 2 and 3

  • 1, 2, and 3

Question 6

In a permutation a1.....an of n distinct integers, an inversion is a pair (ai, aj) such that i < j and ai > aj. What would be the worst-case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of 1.....n with at most n inversions?

  • Θ (n2)

  • Θ (n*log(n))

  • Θ (n1.5)

  • Θ (n)

Question 7

Consider the C program shown below.
C
#include <stdio.h>
#define print(x) printf("%d ", x)
int x;
void Q(int z)
{
    z += x;
    print(z);
}
void P(int *y)
{
    int x = *y + 2;
    Q(x);
    *y = x - 1;
    print(x);
}
main(void)
{
    x = 5;
    P(&x);
    print(x);
}
The output of this program is
  • 12 7 6

  • 22 12 11

  • 14 6 6

  • 7 6 6

Question 8

In a system with 32 bit virtual addresses and 1 KB page size, use of one-level page tables for virtual to physical address translation is not practical because of

  • the large amount of internal fragmentation

  • the large amount of external fragmentation

  • the large memory overhead in maintaining page tables

  • the large computation overhead in the translation process

Question 9

Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statically linked libraries ?

  • Smaller sizes of executable files

  • Lesser overall page fault rate in the system

  • Faster program startup

  • Existing programs need not be re-linked to take advantage of newer versions of libraries

Question 10

A processor uses 2-level page tables for virtual to physical address translation. Page tables for both levels are stored in the main memory. Virtual and physical addresses are both 32 bits wide. The memory is byte addressable. For virtual to physical address translation, the 10 most significant bits of the virtual address are used as index into the first level page table while the next 10 bits are used as index into the second level page table. The 12 least significant bits of the virtual address are used as offset within the page. Assume that the page table entries in both levels of page tables are 4 bytes wide. Further, the processor has a translation look-aside buffer (TLB), with a hit rate of 96%. The TLB caches recently used virtual page numbers and the corresponding physical page numbers. The processor also has a physically addressed cache with a hit rate of 90%. Main memory access time is 10 ns, cache access time is 1 ns, and TLB access time is also 1 ns. Suppose a process has only the following pages in its virtual address space: two contiguous code pages starting at virtual address 0x00000000, two contiguous data pages starting at virtual address 0×00400000, and a stack page starting at virtual address 0×FFFFF000. The amount of memory required for storing the page tables of this process is:

  • 8 KB

  • 12 KB

  • 16 KB

  • 20 KB

Tags:

There are 90 questions to complete.

Take a part in the ongoing discussion