Gate CS-2013 Question Paper With Solutions

Q. 31 Consider the following function:

int unknown(int n) {
    int i, j, k = 0;
    for (i  = n/2; i <= n; i++)
        for (j = 2; j <= n; j = j * 2)
            k = k + n/2;
    return k;
 }

The return value of the function is

Gate CS-2013 Question Paper With Solutions

Answer: (B)

Explanation:

Gate CS-2013 Question Paper With Solutions

Learn More:   Gate EE-2014-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here