1
GATE CSE 2004
MCQ (Single Correct Answer)
+1
-0.3
Consider the following C function:
void swap (int a, int b)
{
   int temp;
   temp = a;
   a = b;
   b = temp;
}
In order to exchange the values of two variables x and y.
A
call swap (x, y)
B
call swap (&x, &y)
C
swap (x, y) cannot be used as it does return any value
D
swap (x, y) cannot be used as the parameters are passed by value
2
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C program
main ( )
{
  int x, y, m, n;
  scanf("%d %d", &x, &y);
  /* Assume x > 0 and y > 0 */
  m=x; n=y;
  while(m!=n)
  {
    if(m>n)
    m=m-n;
    else
    n=n-m;
  }
  printf("%d", n);
}
The program computes
A
x + y using repeated subtraction
B
x mod y using repeated subtraction
C
the greatest common divisor of x and y
D
the least common multiple of x and y
3
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C function:
int f(int n)
{
static int i = 1;
if(n>=5) return n;
n = n+1;
i++;
return f(n);
}
The value returned by f(1) is
A
5
B
6
C
7
D
8
4
GATE CSE 2004
MCQ (Single Correct Answer)
+1
-0.3
Choose the best matching between the programming style in Group 1 and their characteristics in Group 2

Group 1
P. Functional
Q. Logic
R. Object-oriented
S. Imperative

Group 2
1. Command-based, procedural
2. Imperative, abstract data types
3. Side-effect free, declaretive, expression Evaluation
4. Declaretive, clausal representation, theorem proving
A
P - 2 Q - 3 R - 4 S - 1
B
P - 4 Q - 3 R - 2 S - 1
C
P - 3 Q - 4 R - 1 S - 2
D
P - 3 Q - 4 R - 2 S - 1
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12