• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2001

Question 41

What is the minimum number of stacks of size n required to implement a queue of size n?
  • One
  • Two
  • Three
  • Four

Question 42

What is printed by the print statements in the program P1 assuming call by reference parameter passing?
Program P1()
{
   x = 10;
   y = 3;
   func1(y,x,x);
   print x;
   print y;
}
func1(x,y,z)
{
   y = y+4;
   z = x+y+z;
}
  • 10, 3
  • 31, 3
  • 27, 7
  • None of the above

Question 43

Consider the following three C functions : C
[PI] int * g (void) 
{ 
  int x= 10; 
  return (&x); 
}  
   
[P2] int * g (void) 
{ 
  int * px; 
  *px= 10; 
  return px; 
} 
   
[P3] int *g (void) 
{ 
  int *px; 
  px = (int *) malloc (sizeof(int)); 
  *px= 10; 
  return px; 
}
Which of the above three functions are likely to cause problems with pointers? (GATE 2001) (A) (B) (C) (D)
  • Only P3
  • Only P1 and P3
  • Only P1 and P2
  • P1, P2 and P3

Question 44

Consider the following program pascal
Program P2 
    var n: int: 
     procedure W(var x: int) 
     begin 
         x=x+1; 
         print x;   
     end 

     procedure D 
     begin  
         var n: int; 
         n=3; 
         W(n);  
     end 
begin //beginP2 
  n=10; 
  D; 
end 
If the language has dynamic scoping and parameters are passed by reference, what will be printed by the program?
  • 10
  • 11
  • 3
  • None of the above

Question 45

Which of the following does not interrupt a running process?
  • A device
  • Timer
  • Scheduler process
  • Power failure

Question 46

Consider a machine with 64 MB physical memory and a 32-bit virtual address space. If the page size is 4KB, what is the approximate size of the page table?

  • 16 MB

  • 8 MB

  • 2 MB

  • 24 MB

Question 47

Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
   repeat   
      flag [i] = true; 
      turn = j; 
      while ( P ) do no-op; 
      Enter critical section, perform actions, then exit critical 
      section 
      flag [ i ] = false; 
      Perform other non-critical section actions. 
   until false; 
For the program to guarantee mutual exclusion, the predicate P in the while loop should be.
  • flag[j] = true and turn = i
  • flag[j] = true and turn = j
  • flag[i] = true and turn = j
  • flag[i] = true and turn = i

Question 48

R(A,B,C,D) is a relation. Which of the following does not have a lossless join, dependency preserving BCNF decomposition?
  • A->B, B->CD
  • A->B, B->C, C->D
  • AB->C, C->AD
  • A ->BCD

Question 49

Which of the following relational calculus expressions is not safe? GATECS2000Q49
  • A
  • B
  • C
  • D

Question 50

Consider a relation geq which represents “greater than or equal to”, that is, (x,y) ∈ geq only if y >= x.
create table geq
( 
  ib integer not null
  ub integer not null
  primary key 1b
  foreign key (ub) references geq on delete cascade 
)
Which of the following is possible if a tuple (x,y) is deleted?
  • A tuple (z,w) with z > y is deleted
  • A tuple (z,w) with z > x is deleted
  • A tuple (z,w) with w < x is deleted
  • The deletion of (x,y) is prohibited

There are 50 questions to complete.

Last Updated :
Take a part in the ongoing discussion