Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2015 Set 1
Questions

Q31

MCQ2 marks, −0.67AlgorithmsMedium

Consider the following C function.

int fun1 (int n) {
    int i, j, k, p, q = 0;
    for (i = 1; i < n; ++i)
    {
        p = 0;
        for (j = n; j > 1; j = j/2)
            ++p;
        for (k = 1; k < p; k = k * 2)
            ++q;
    }
    return q;
}

Which one of the following most closely approximates the return value of the function fun1\text{fun1}?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.