GATE CS 2008 (original) (raw)

Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?

C `

a = ( x > y ) ? (( x > z ) ? x : z) : (( y > z ) ? y : z )

`

The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows:

P(s) : s = s - 1;
if (s < 0) then wait;
V(s) : s = s + 1;
if (s <= 0) then wakeup a process waiting on s;

Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores Xb and Yb are used to implement the semaphore operations P(s) and V(s) as follows:

P(s) : Pb(Xb);
s = s - 1;
if (s < 0) {
Vb(Xb) ;
Pb(Yb) ;
}
else Vb(Xb);

V(s) : Pb(Xb) ;
s = s + 1;
if (s <= 0) Vb(Yb) ;
Vb(Xb) ;

The initial values of Xb and Yb are respectively

A process executes the following code

for (i = 0; i < n; i++) fork();

The total number of child processes created is

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then

A processor uses 36 bit physical addresses and 32 bit virtual addresses, with a page frame size of 4 Kbytes. Each page table entry is of size 4 bytes. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows
• Bits 30-31 are used to index into the first level page table
• Bits 21-29 are used to index into the second level page table
• Bits 12-20 are used to index into the third level page table, and
• Bits 0-11 are used as offset within the page
The number of bits required for addressing the next level page table (or page frame) in the page table entry of the first, second and third level page tables are respectively.

Which of the following statements about synchronous and asynchronous I/O is NOT true?

The data blocks of a very large file in the Unix file system are allocated using

For a magnetic disk with concentric circular tracks, the seek latency is not linearly proportional to the seek distance due to

What is printed by the following C program?

C `

$include <stdio.h> int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; *py += 2; y = *py; x += 3; return x + y + z; }

void main() { int c, *b, **a; c = 4; b = &c; a = &b; printf( "%d", f(c,b,a)); getchar(); }

`

  1. Let R and S be two relations with the following schema
    R (P,Q,R1,R2,R3)
    S (P,Q,S1,S2)
    Where {P, Q} is the key for both schemas. Which of the following queries are equivalent?

There are 85 questions to complete.

Take a part in the ongoing discussion