+0  
 
0
1091
2
avatar

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

 Feb 8, 2021
 #1
avatar+9519 
0

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

 Feb 8, 2021
 #2
avatar+33614 
+4

This might help you understand the result given by Max:

 

 Feb 8, 2021

1 Online Users

avatar