Most Repeated Programming Question | UGC NET PYQs 2021, 2019 Programming | by Priyanka Chatterjee

Поділитися
Вставка
  • Опубліковано 13 жов 2024
  • Must Watch to confirm your Marks in Programming with Right Shift , Bit wise AND Operator.
    What does the following function f() in ‘c’ return?
    Int f(unsigned int N) {
    unsigned int counter = 0;
    while (N greater than 0)
    {counter += N & 1;
    N=N right shift 1;}
    return counter == 1;
    }
    1 If N is a power of 2, otherwise 0,
    1 if N is odd, otherwise 0,
    1 if the binary representation of N has any 1’s, otherwise 0,
    1 if the binary representation of N has all 1’s, otherwise 0,

КОМЕНТАРІ • 5