C# Programming - Operators - Discussion
Discussion Forum : Operators - General Questions (Q.No. 2)
2.
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);
Discussion:
33 comments Page 1 of 4.
Kumar said:
6 years ago
OR operator
how it is possible ?
11110111
10101011
_________
01011100 = 92
OR operator
1 1 T
1 0 T
0 1 T
0 0 F
how it is possible ?
11110111
10101011
_________
01011100 = 92
OR operator
1 1 T
1 0 T
0 1 T
0 0 F
Siva said:
9 years ago
For simple calculations use these code for fast conversion for decimal to binary and binary to desired values "8421".
Hexadecimal values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
A =10
So, we take 8 4 2 1
=> 1 0 1 0 = 8 + 2 = 10.
F = 15
So, we take 8 4 2 1
=> 1 1 1 1= 8 + 4 + 2 + 1 = 15.
Hexadecimal values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
A =10
So, we take 8 4 2 1
=> 1 0 1 0 = 8 + 2 = 10.
F = 15
So, we take 8 4 2 1
=> 1 1 1 1= 8 + 4 + 2 + 1 = 15.
Sai said:
9 years ago
How to identify f = 15.... a = 10?
Aparna said:
1 decade ago
I have one doubt in or ^ operator because or operator explain that if both value are true than answer should be true or infect one value are also true than answer will true.
Like 10101100.
10011001.
Answer = 10111101.
Like 10101100.
10011001.
Answer = 10111101.
Mamatha said:
1 decade ago
Here is the total procedure to compute the value.
1 0 1 0 0 0 1 1.
2^7*1 2^6*0 2^5*1 2^4*0 2^3*0 2^2*0 2^1*1 2^0*1.
128+0+32+0+0+0+2+1 = 163.
1 0 1 0 0 0 1 1.
2^7*1 2^6*0 2^5*1 2^4*0 2^3*0 2^2*0 2^1*1 2^0*1.
128+0+32+0+0+0+2+1 = 163.
Sailu said:
1 decade ago
@Swethasai I'm giving clarification for your doubt.
Here 10100011 convert into decimal number 128+0+32+0+0+0+2+1 = 163.
Here 10100011 convert into decimal number 128+0+32+0+0+0+2+1 = 163.
REVATHI said:
1 decade ago
What about 92?
Pooja Uttam said:
1 decade ago
128 64 32 16 8 4 2 1.
1 0 1 0 0 0 1 1 => 128+32+2+1 = 163.
1 0 1 0 0 0 1 1 => 128+32+2+1 = 163.
(1)
Swethasai said:
1 decade ago
Excuse me I have one doubt in above explanation how come 10100011 is equal to 163 can anybody explain I am not able to understand.
Savu said:
1 decade ago
I think @Arif provided the best explanation for this. Cheers buddy.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers