GATE 2014 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2014 (Session 2)

65 questions

MCQ 42 · NAT 231-mark 30 · 2-mark 35

Questions 41–45 of 65

Q41Process Synchronization2 marksMCQ−0.67 if wrong
Consider the procedure below for the Producer-Consumer problem which uses semaphores:
semaphore n = 0;
semaphore s = 1;
void producer()                    void consumer()
{                                  {
      while(true)                        while(true)
      {                                  {
       produce();                         semWait(s);
       semWait(s);                        semWait(n);
       addToBuffer();                     removeFromBuffer();
       semSignal(s);                      semSignal(s);
       semSignal(n);                      consume();
      }                                  }
}                                  }

Which one of the following is TRUE?

Q42CPU Scheduling2 marksNAT
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 tct_{c} CPU milliseconds and then initiates a single I/O operation that lasts for tiot_{io} 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 100ms 500ms B 350ms 500ms C 200ms 500ms
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 ___________.

Q43Memory Management2 marksMCQ−0.67 if wrong
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?

Q44Intermediate Code Generation2 marksMCQ−0.67 if wrong
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?

Q45Turing Machine2 marksMCQ−0.67 if wrong
Let <M>\lt M \gt be the encoding of a Turing machine as a string over Σ\Sigma={0,1}.
Let L = { <M>\lt M \gt |M is a Turing machine that accepts a string of length 2014}.
Then, L is