1
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main;
  Var . . .

  Procedure A1;
      Var . . .
      Call A2;
  End A1

  Procedure A2;
      Var . . .

      Procedure A21;
        Var . . .
        Call A1;
      End A21

      Call A21;
  End A2

  Call A1;
End main.
Consider the calling chain: Main $$ \to $$ A1 $$ \to $$ A2 $$ \to $$ A21 $$ \to $$ A1
The correct set of activation records along with their access links is given by
A
GATE CSE 2012 Programming Languages - Function and Recursion Question 18 English Option 1
B
GATE CSE 2012 Programming Languages - Function and Recursion Question 18 English Option 2
C
GATE CSE 2012 Programming Languages - Function and Recursion Question 18 English Option 3
D
GATE CSE 2012 Programming Languages - Function and Recursion Question 18 English Option 4
2
GATE CSE 2011
MCQ (Single Correct Answer)
+2
-0.6
Consider the following recursive C function that takes two arguments:
unsigned int foo (unsigned int n, unsigned int r) {
  if (n > 0) return((n % r) + foo(n/r, r));
  else return 0;
}
What is the return value of the function foo when it is called as foo (345, 10)?
A
345
B
12
C
5
D
3
3
GATE CSE 2011
MCQ (Single Correct Answer)
+2
-0.6
Consider the following recursive C function that takes two arguments:
unsigned int foo (unsigned int n, unsigned int r) {
  if (n > 0) return((n % r) + foo(n/r, r));
  else return 0;
}
What is the return value of the function foo when it is called as foo (513, 2)?
A
9
B
8
C
5
D
2
4
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
Choose the correct option to fill ? 1 and ? 2 so that the program below prints an input string in reverse order. Assume that the input string is terminated by a newline character.
void recerse (void) {
  int c;
  if (?1) reverse() ;
  ?2
}
main {
  printf ("Enter Text" ); 
  printf("\n");
  reverse() ;
  printf("\n") ;
}
A
?1 is (getchar ( )! = '\ n')
?2 is getchar (c);
B
?1 is ((c = getchar ( ) )! = '\ n')
?2 is getchar (c);
C
?1 is (c ! = '\ n')
?2 is putchar (c);
D
?1 is ((c = getchar ( ) )! = '\ n')
?2 is putchar (c);
GATE CSE Subjects
Software Engineering
Web Technologies
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