GATE | GATE-CS-2002 | Question 17

In the C language
(A) At most one activation record exists between the current activation record and the activation record for the main
(B) The number of activation records between the current activation record and the activation record for the main depends on the actual function calling sequence.
(C) The visibility of global variables depends on the actual function calling sequence.
(D) Recursion requires the activation record for the recursive function to be saved on a different stack before the recursive function can be called.

Answer: (B)


The portion of the stack used for an invocation of a function is called the function’s stack frame or activation record.
An activation record is another name for Stack Frame. It’s the data structure that composes a call stack. It is generally composed of:

  • Locals to the callee
  • Return address to the caller
  • Parameters of the callee

The Call Stack is thus composed of any number of activation records that get added to the stack as new subroutines are added, and removed from the stack (usually) as they return.
In C language the program execution starts with main function, so it is the first activation record in the function stack. Now looking at each option-:

Option aThe statement is false as any number of functions can be called from the main. It might not be necessary that at-most one activation record exist and activation record of main.
For example- as in case of recursion.

Recurse (int n)
         return ;

In above example activation record of main and recurse(4) will have activation record of recurse(5), recurse(6) (more than one) if we pass n=6 initially to the function.

Option b– True as soon as a function is called its activation record is created in the function stack.

Option c– In C language variables are statically scoped not dynamically, the global variables are statically assigned address space when the execution starts not depending on when and where they are used.

Option d– The functions are stored in the same each time recursive call is made, considering the above recurse function




This solution is contributed by Parul sharma.


Quiz of this Question

My Personal Notes arrow_drop_up

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.