Gate2020 cs Q54

0. Consider the following C functions.

Gate2020 cs

The value returned by pp(3, 4) is ______.

Note – Numerical Type question

  • Option : A
  • Explanation :
    PP(3, 4) = _____
    PP function:
    Gate2020 cs
    Len = tob(b, arr)
    tob functions:
    Gate2020 cs
    i = 0 4 > 0, (with b = 4)
    if (4 % 2) False, so else gets executed
    So, arr[0] = 0,
    if t b = b/2
    i = 1 2 > 0 (with b = 2)
    if (2 % 2) false
    So, else gets executed ⇒ arr [1] = 0, i = i + t b = b/2
    i = 2 1 > 0 (with b = 1)
    if (1 % 2) True arr [2] = 1 i + 1, b = b/2
    i = 30 > 0 (with b = 0) false
    return I, returns ‘3’ to len, in PP function.
    In PP function: len = 3
    For loop.
    i = 0i = 1i = 2
    ex = 3 x 3ex = 9 x 3tot = t * t *ex
    = 9= 81= 1 * 81 = 81
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *