Question: Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly?

Options

A : if ((n& 16 ) == 16 ) Console.WriteLine( "Fourth bit is ON" );

B : if ((n& 8 ) == 8 ) Console.WriteLine( "Fourth bit is ON" );

C : if ((n ! 8 ) == 8 ) Console.WriteLine( "Fourth bit is ON" );

D : if ((n ^ 8 ) == 8 ) Console.WriteLine( "Fourth bit is ON" );

Click to view Correct Answer

Previous || Next

Operators - General Questions more questions

Which of the following is NOT a Bitwise operator in....

Which of the following statements is correct about the C#.NET....

Which of the following is the correct output for the....

Which of the following statements are correct about the Bitwise....

Which of the following are Logical operators in C#.NET?

What will be the output of the C#.NET code snippet....

Suppose n is a variable of the type Byte and....

What will be the output of the C#.NET code snippet....

Which of the following is NOT an Assignment operator in....

What will be the output of the C#.NET code snippet....

Attributes - General Questions more Online Exam Quiz

Functions and Subroutines - General Questions

Inheritance - General Questions

Interfaces - General Questions

Namespaces - General Questions

Polymorphism - General Questions

Properties - General Questions

Structures - General Questions

Advanced SQL - General Questions

Data and Database Administration - General Questions