• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2014-(Set-2)

Question 41

Three processes A, B and C each execute a loop of 100 iterations. In each iteration of the loop, a process performs a single computation that requires tc CPU milliseconds and then initiates a single I/O operation that lasts for tio milliseconds. It is assumed that the computer where the processes execute has sufficient number of I/O devices and the OS of the computer assigns different I/O devices to each process. Also, the scheduling overhead of the OS is negligible. The processes have the following characteristics:

 Process id      tc           tio
     A        100 ms    500 ms
     B        350 ms    500 ms
     C        200 ms    500 ms

The processes A, B, and C are started at times 0, 5 and 10 milliseconds respectively, in a pure time sharing system (round robin scheduling) that uses a time slice of 50 milliseconds. The time in milliseconds at which process C would complete its first I/O operation is ___________.

  • 500

  • 1000

  • 2000

  • 10000

Question 42

A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?
  • Least-recently-used
  • First-in-first-out
  • Last-in-first-out
  • Most-recently-used

Question 43

For a C program accessing X[i][j][k], the following intermediate code is generated by a compiler. Assume that the size of an integer is 32 bits and the size of a character is 8 bits.
  t0 = i ∗ 1024
  t1 = j ∗ 32
  t2 = k ∗ 4
  t3 = t1 + t0
  t4 = t3 + t2
  t5 = X[t4] 
Which one of the following statements about the source code for the C program is CORRECT?
  • X is declared as “int X[32][32][8]”.
  • X is declared as “int X[4][1024][32]”.
  • X is declared as “char X[4][32][8]”.
  • X is declared as “char X[32][16][2]”.

Question 44

Let L1 = {w ∈ {0,1} | w has at least as many occurrences of (110)’s as (011)’s}. 
Let L2 = { ∈ {0,1} | w has at least as many occurrences of (000)’s as (111)’s}. 
 
Which one of the following is TRUE?

  • L1 is regular but not L2

  • L2 is regular but not L!

  • Both L2 and L1 are regular

  • Neither L1 nor L2 are regular

Question 45

Let be the encoding of a Turing machine as a string over ∑= {0, 1}.  Let L = { |M is a Turing machine that accepts a string of length 2014 }. Then, L is
  • decidable and recursively enumerable
  • undecidable but recursively enumerable
  • undecidable and not recursively enumerable
  • decidable but not recursively enumerable

Question 46

Suppose P, Q, R, S, T are sorted sequences having lengths 20, 24, 30, 35, 50 respectively. They are to be merged into a single sequence by merging together two sequences at a time. The number of comparisons that will be needed in the worst case by the optimal algorithm for doing this is ____.
  • 358
  • 438
  • 568
  • 664

Question 47

Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ___. GATECS2014Q38
  • 4
  • 6
  • 8
  • 10

Question 48

Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?

  • A queue cannot be implemented using this stack.

  • A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions.

  • A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction.

  • A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.

Question 49

Consider the JAVA function given below. 

Java
static  int f(int j){
  int i = 50;
  int k;
  if (i == j){
    System.out.print("something");
    k = f(i);
    return 0;
  }
  else return 0;
}

Which one of the following is TRUE?

  • The function returns 0 for all values of j.

  • The function prints the string something for all values of j.

  • The function returns 0 when j = 50.

  • The function will exhaust the runtime stack or run into an infinite loop when j = 50

Question 50

In designing a computer’s cache system, the cache block (or cache line) size is an important parameter. Which one of the following statements is correct in this context?
  • A smaller block size implies better spatial locality
  • A smaller block size implies a smaller cache tag and hence lower cache tag overhead
  • A smaller block size implies a larger cache tag and hence lower cache hit time
  • A smaller block size incurs a lower cache miss penalty

There are 64 questions to complete.

Last Updated :
Take a part in the ongoing discussion