Sunday, 10 February 2013

GATE Exam 2013 Computer science answer key

37. In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are
a) Last fragment, 2400 and 2789
b) First fragment, 2400 and 2759
c) Last fragment, 2400 and 2759
d) Middle fragment, 300 and 689
Answer: c

38. The following figure represents access graphs of two modules M1 and M2. The filled circles represent methods and the unfilled circles represent attributes. If method m is moved to module M2 keeping the attributes where they are, what can we say about the average cohesion and coupling between modules in the system of two modules?
Gate exam question
a) There is no change.
b) Average cohesion goes up but coupling is reduced.
c) Average cohesion goes down and coupling also reduces.
d) Average cohesion and coupling increase.


39. A certain computation generates two arrays a and b such that A[i] = f (i) for 0 £ i < n and b[i]=g(a[i]) for 0 £ i< n. Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array a and Y computes the array b. The processes employ two binary semaphores R and S, both initialized to zero. The array a is shared by the two processes. The structures of the processes are shown below.
Process X;                                Process Y;
private i;                                    private i;
for(i=0; i<n; i++) {                      for( i=0; i<n; i++) {
a[i]= f[i] ;                                   EntryY(R, S) ;
ExitX (R, S);                              b[i]=g(a[i]) ;
}                                               }

Which one of the following represents the CORRECT implementations of ExitX and EntryY?

a)
ExitX (R, S) {
P(R);
V(S);
}
EntryY (R, S) {
P( S) ;
V(R) ;
}
b)
ExitX (R, S) {
V( R) ;
V( S) ;
}
EntryY (R, S) {
P( R );
P( S );
}

c)
ExitX (R, S) {
P( S);
V( R) ;
}
EntryY ( R, S) {
V( S) ;
P( R );
}
d)
ExitX (R, S) {
V( R ) ;
P( S );
}
EntryY ( R, S) {
V (S ) ;
P( R ) ;
}

Answer: d

40. Consider the following two sets of LR(1) items of an LR(1) grammar.
X → c.X, c / d                X → c.X, $
X → .cX, c / d               X→ .cX, $
X →.d, c / d                  X →.d, $
Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?
1. Cannot be merged since look aheads are different
2. Can be merged but will result in S–R conflict
3. Can be merged but will result in R–R conflict
4. Cannot be merged since goto on c will lead to two different sets

a)1 only
b) 2 only
c) 1 and 4 only
d) 1, 2, 3 and 4
Answer: d

41. Which of the following is/are undecidable?
1. G is a CFG. Is L (G) = F?
2. G is a CFG. IS L (G) = S * ?
3. M is a Turning machine. Is L(M) regular?
4. A is a DFA and N is a NFA. Is L (A) = L (N) ?

a) 3 only
b) 3 and 4 only
c) 1, 2 and 3 only
d) 2 and 3 only
Answer: d

Next : Gate 2013 Question and answer 42-49
Previous: GATE 2013 Answer key CS and IT questions 30-36

No comments:

Post a Comment