Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Operators
Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?
n = n && HF7
n = n & 16
n = n & 0xF7
n = n & HexF7
n = n & 8
Correct Answer:
n = n & 0xF7
← Previous Question
Next Question→
More Questions from
Operators
Which of the following are the correct ways to increment the value of variable a by 1? ++a++; a += 1; a ++ 1; a = a +1; a = +1;
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?
What will be the output of the C#.NET code snippet given below? byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write (temp + " "); temp = (byte)(b1^b2); Console.WriteLine(temp);
Which of the following are Logical operators in C#.NET? && || ! Xor %
Which of the following statements are correct about the following code snippet? int a = 10; int b = 20; bool c; c = !(a > b); There is no error in the code snippet. An error will be reported since ! can work only with an int. A value 1 will be assigned to c. A value True will be assigned to c. A value False will be assigned to c.
Which of the following statements are correct about the Bitwise & operator used in C#.NET? The & operator can be used to Invert a bit. The & operator can be used to put ON a bit. The & operator can be used to put OFF a bit. The & operator can be used to check whether a bit is ON. The & operator can be used to check whether a bit is OFF.
What will be the output of the C#.NET code snippet given below? byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + " "); temp = (byte)(b1 << b2); Console.Write (temp + " "); temp = (byte) (b2 >> 2); Console.WriteLine(temp);
Which of the following statements is correct about the C#.NET code snippet given below? int d; d = Convert.ToInt32( !(30 < 20) );
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments