• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 2008

Question 51

Which of the following are true?
I. A programming language which does not permit global variables of any
   kind and has no nesting of procedures/functions, but permits recursion 
   can be implemented with static storage allocation
II. Multi-level access link (or display) arrangement is needed to arrange 
    activation records only if the programming language being implemented 
    has nesting of procedures/functions
III. Recursion in programming languages cannot be implemented with dynamic 
     storage allocation
IV. Nesting of procedures/functions and recursion require a dynamic heap 
    allocation scheme and cannot be implemented with a stack-based allocation
    scheme for activation records
V. Programming languages which permit a function to return a function as its 
   result cannot be implemented with a stack-based storage allocation scheme 
   for activation records
  • II and V only
  • I, III and IV only
  • I, II and V only
  • II, III and V only

Question 52

An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
  • the SLR(1) parser for G has S-R conflicts
  • the LR(1) parser for G has S-R conflicts
  • the LR(0) parser for G has S-R conflicts
  • the LALR(1) parser for G has reduce-reduce conflicts

Question 53

In the slow start phase of the TCP congestion control algorithm, the size of the congestion window
  • does not increase
  • increases linearly
  • increases quadratically
  • increases exponentially

Question 54

If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of hosts per subnet?
  • 1022
  • 1023
  • 2046
  • 2047

Question 55

A computer on a 10Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 2Mbps. It is initially filled to capacity with 16Megabits. What is the maximum duration for which the computer can transmit at the full 10Mbps?
  • 1.6 seconds
  • 2 seconds
  • 5 seconds
  • 8 seconds

Question 56

A client process P needs to make a TCP connection to a server process S. Consider the following situation: the server process S executes a socket(), a bind() and a listen() system call in that order, following which it is preempted. Subsequently, the client process P executes a socket() system call followed by connect() system call to connect to the server process S. The server process has not executed any accept() system call. Which one of the following events could take place?
  • connect () system call returns successfully
  • connect () system call blocks
  • connect () system call returns an error
  • connect () system call results in a core dump

Question 57

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();
}
  • 18
  • 19
  • 21
  • 22

Question 58

Choose the correct option to fill ?1 and ?2 so that the program below prints an input string in reverse order. Assume that the input string is terminated by a newline character. C
void reverse(void)
 {
  int c;
  if (?1) reverse();
  ?2
}
int main()
{
  printf (\"Enter Text \") ;
  printf (\"\\n\") ;
  reverse();
  printf (\"\\n\") ;
}
  • ?1 is (getchar() != ’\\n’)
    ?2 is getchar(c);
  • ?1 is (c = getchar() ) != ’\\n’)
    ?2 is getchar(c);
  • ?1 is (c != ’\\n’)
    ?2 is putchar(c);
  • ?1 is ((c = getchar()) != ’\\n’)
    ?2 is putchar(c);

Question 59

The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the function completes execution? C
struct node
{
  int value;
  struct node *next;
};
void rearrange(struct node *list)
{
  struct node *p, * q;
  int temp;
  if ((!list) || !list->next)
      return;
  p = list;
  q = list->next;
  while(q)
  {
     temp = p->value;
     p->value = q->value;
     q->value = temp;
     p = q->next;
     q = p?p->next:0;
  }
}
  • 1,2,3,4,5,6,7
  • 2,1,4,3,6,5,7
  • 1,3,2,5,4,7,6
  • 2,3,4,5,6,7,1

Question 60

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
  • 0 and 0
  • 0 and 1
  • 1 and 0
  • 1 and 1

There are 85 questions to complete.

Last Updated :
Take a part in the ongoing discussion