1
GATE CSE 2013
MCQ (Single Correct Answer)
+2
-0.6
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:
private i;
for(i = 0; i < n; i++){
 a [i] = f (i);
 Exit X (R, S);
}

Process Y:
private i;
for(i = 0; i < n; i++){
 Entry Y (R, S);
 b [i] = g (a [i] );
}
Which of the following represents the correct implementations of Exit X and Entry Y?
A
Exit X (R, S){
  P(R);
  V(S);
}
Entry Y (R, S){
  P(S);
  V(R);
}
B
Exit X (R, S){
  V(R);
  V(S);
}
Entry Y (R, S){
  P(R);
  P(S);
}
C
Exit X (R, S){
  P(S);
  V(R);
}
Entry Y (R, S){
  V(S);
  P(R);
}
D
Exit X (R, S){
  V(R);
  P(S);
}
Entry Y (R, S){
  V(S);
  P(R);
}
2
GATE CSE 2013
MCQ (Single Correct Answer)
+2
-0.6
What is the return value of f (p, p), if the value of p is initialized to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value.
int f (int &x, int c) {
    c = c - 1;
    if (c==0) return 1;
    x = x + 1;
    return f(x,c) * x;
}
A
3024
B
6561
C
55440
D
161051
3
GATE CSE 2013
MCQ (Single Correct Answer)
+2
-0.6
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 CSE 2013 Software Engineering - Software Engineering Question 10 English
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.
4
GATE CSE 2013
MCQ (Single Correct Answer)
+2
-0.6
The procedure given below is required to find and replace certain characters inside an input character string supplied in array $$A.$$ The characters to be replaced are supplied in array $$oldc,$$ while their respective replacement characters are supplied in array $$newc.$$ Array $$A$$ has a fixed length of five characters, while arrays $$oldc$$ and $$newc$$ contain three characters each. However, the procedure is flawed. void find_and_replace (char $$^ * A,$$ char $$^ * oldc,$$, char $$^ * newc$$)
$$\left\{ \, \right.$$ for (int $$i=0; i<5; i++$$)
for (int $$j=0; j<3; j++$$)
if ( $$A$$ [ $$i$$ ] $$==oldc$$ [ $$j$$ ] $$A$$ [ $$i$$ ]
$$=newc$$ [ $$j$$ ]; $$\left. \, \right\}$$

The procedure is tested with the following four test cases;
$$\eqalign{ & \left( 1 \right)\,\,\,oldc = ''abc'',\,\,newc\, = \,''dab'' \cr & \left( 2 \right)\,\,\,oldc\, = \,''cdc'',\,\,newc\, = \,''bed'' \cr & \left( 3 \right)\,\,\,oldc\, = \,''bca'',\,newc\, = \,''cda'' \cr & \left( 4 \right)\,\,\,oldc\, = \,''abc'',\,newc\, = \,''bac'' \cr} $$

The tester now tests the program on all input strings of length five consisting of characters $$'a', 'b', 'c', 'd'$$ and $$'c'$$ with duplicates allowed. If the tester carries out this testing with four test cases given above, how many test cases will be able to capture the flaw?

A
Only one
B
Only two
C
Only three
D
All four
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12