In the C language, which of the following statements is true?

2002

In the C language, which of the following statements is true?

Answer: 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.Each function call in C creates an activation record on the runtime call stack. The number of activation records between the current activation record and the…

  1. A.

    At most one activation record exists between the current activation record and the activation record for the main

  2. 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.

  3. C.

    The visibility of global variables depends on the actual function calling sequence.

  4. D.

    Recursion requires the activation record for the recursive function to be saved on a different stack before the recursive function can be called.

Attempted by 49 students.

Show answer & explanation

Correct answer: B

Each function call in C creates an activation record on the runtime call stack. The number of activation records between the current activation record and the activation record for main depends on the exact sequence of calls that led to the current point, including nested calls or recursion. Global variable visibility in C is controlled by scope and linkage, not by the call sequence, and recursive calls use additional activation records on the same stack. Therefore, the correct statement is that the number of activation records depends on the actual function calling sequence.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…