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

GATE 2017 (Session 2)

65 questions

MCQ 45 · NAT 201-mark 30 · 2-mark 35

Questions 51–55 of 65

Q51Undecidability2 marksMCQ−0.67 if wrong
Let L(R) be the language represented by regular expression R. Let L(G) be the language generated by a context free grammar G. Let L (M) be the language accepted by a Turning machine M. Which of the following decision problems are undecidable ?

I. Given a regular expression R and a string w, is w∈\inL(R)?
II. Given a context-free grammar G, L(G)=ϕ\phi?
III. Given a context-free grammar G, is L(G)=Σ\Sigma* for some alphabet Σ\Sigma?
IV. Given a Turning machine M and a string w, is w∈\inL(M)?

Q52Sequential Circuit2 marksMCQ−0.67 if wrong
The next state table of a 2-bit saturating up-counter is given below.
Q1Q0Q1+Q0+0001011010111111\begin{matrix} Q_{1} & Q_{0} & Q_{1}^{+} &Q_{0}^{+} \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0\\ 1 & 0 & 1 & 1\\ 1 & 1 & 1 & 1 \end{matrix}
The counter is built as a synchronous sequential circuit using T flip-flops. The expression for T1  and  T0T_1 \; and \; T_0 are

Q53Array and Pointer2 marksNAT
Consider the following snippet of a C program. Assume that swap (&x, &y) exchanges the contents of x and y.

int main ( ) {
int array[]={3,5,1,4,6,2};
int done =0 ;
int i ;
while (done == 0) {
   done = 1;
   for (i = 0; i <=4; i ++) {
   if (array [i] < array [i +1]) {
       swap (& array [i], &array [i+1]);
       done = 0;
    }
}
for (i = 5 ; i >=1; i --) {
if (array [i] > array [ i-1]) {
    swap ( & array [i] , &array [i-1]);
     done = 0;
  }
} }
printf ( " %d " , array [3] );
}
The output of the program is ____________.

Q54Transaction2 marksNAT
Two transactions T1  and  T2T_1 \; and \; T_2 are given as:

T1:r1(X)w1(X)r1(Y)w1(Y)T_{1}:r_{1} (X)w_{1}(X)r_{1}(Y)w_{1}(Y)
T2:r2(Y)w2(Y)r2(Z)w2(Z)T_{2}:r_{2}(Y)w_{2}(Y)r_{2}(Z)w_{2}(Z)

where ri(V)r_{i}(V) denotes a read operation by transaction TiT_{i} on a variable V and wi(V)w_{i}(V) denotes a write operations by transaction TiT_{i} on a variable V. The total number of conflict serializable schedules that can be formed by T1  and  T2T_1 \; and \; T_2 is _____________.

Q55Cache Memory2 marksNAT
The read access times and the hit ratios for different caches in a memory hierarchy are as given below.
Cache Read access time (in nanoseconds) Hit ratio I-cache 2 0.8 D-cache 2 0.9 L2-cache 8 0.9
The read access time of main memory is 90 nanoseconds. Assume that the caches use the referred word-first read policy and the write back policy. Assume that all the caches are direct mapped caches. Assume that the dirty bit is always 0 for all the blocks in the caches. In execution of a program, 60% of memory reads are for instruction fetch and 40% are for memory operand fetch. The average read access time in nanoseconds (up to 2 decimal places) is______.