Examveda

Choose the correct statement for the following code segment?
bool check (int N)
{
    if( N & (1 << i) )
        return true;
    else
        return false;
}

A. function returns true if N is odd

B. function returns true if N is even

C. function returns true if ith bit of N is set

D. function returns false if ith bit of N is set

Answer: Option C


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures