what is the answer Find the bitwise OR, bitwise AND, and bitwise XOR of each of these pairs of bit strings.
a) 101 1110, 010 0001
Just use a program to find it.
C++ source code: (G++ compiler, C++14)
#include
using namespace std;
int main(){
int a = 0b1011110, b = 0b0100001;
printf("Bitwise OR: %x\nBitwise AND: %x\nBitwise XOR: %x", a|b, a&b, a^b);
}
Output:
Bitwise OR: 7f
Bitwise AND: 0
Bitwise XOR: 7f
You may notice the output is in base 16. But converting base 16 to base 2 is easy.
Bitwise OR of the two numbers gives 1111111
Bitwise AND gives 0000000
Bitwise XOR gives 1111111