Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

needs to be in c needs to be in C Test Case 1: Enter two integers, 0 and 0 , as a classic case to

needs to be in c image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
needs to be in C
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Test Case 1: Enter two integers, 0 and 0 , as a classic case to test program functi 0 0 You entered two integers as your input: 00 Binary bit patterns of inputA and inputB are: 00000000000000000000000000000000 00000000000000000000000000000000 . ENTERING xorAB result of XOR bitwise operation (ab) is 0 00000000000000000000000000000000 ENTERING andNotsAB result of operation using bitwise \& is is 00000000000000000000000000000000 > ENTERING maxMinInt int x just after u=1 111111111111111111111111111111 int y just after u=1 11111111111111111111111111111 max int x=2147483647 01111111111111111111111111111 most negative (min) int y=2147483648 10000000000000000000000000000000 Test Case 2: Enter integers that are the bitwise opposites of each other to see how XOR works with no bits in any of the positions having the same value when the integers are compared to each other. Notice how the 15 "fall through" to the xor result. There are no 1 bits that are present in the same position of either binary You entered two integers as your input: 10737418241073741823 Test Case 3: Test Case 3: Enter two five-digit numbers. Notice how sometimes the xor of two numbers ends up being greater than either. That is because the xor keeps the 1 bits in both binaries as long as there is a 1 in only one of the binaries in a given position. 12345 You entered two integers as your input: 1234567890 Binary bit patterns of inputA and inputB are: 00000000000000000011000000111001 00000000000000010000100100110010 result of XOR bitwise operation (ab) is result of operation using bitwise & is is 80139 00000000000000010011100100001011 ENTERING andNotsAB result of operation using bitwise & is is 80139 00000000000000010011100100001011 ENTERING maxMinInt int x just after 0u=1 111111111111111111111111111111 int y just after 0u=1 111111111111111111111111111111 max int x=2147483647 max int x=2147483647 most negative (min) int y=2147483648 10000000000000000000000000000000 Test Case 4: Enter the largest positive signed integer (32-bit) and a number that is all 15. Both numbers are ten digits in length. The resulting xor integers and binaries will be the same length. 2147483647 1111111111 You entered two integers as your input: 21474836471111111111 Binary bit patterns of inputA and inputB are: 01111111111111111111111111111111 01000010001110100011010111000111 result of XOR bitwise operation (a b) is 1036372536 be111101110001011100101000111000 > ENTERING andNotsAB result of operation using bitivise is is 1036372536 0011101110001011100101000111000 >>>>>> ENTERING maxMinInt int x just after 0u=1 1111111111111111111111111111 int y just ofter 0u=1 1111111111111111111111111111111 max int x=2147483647 0111111111111111111111111111 most negative (min ) int y=2147483648 1000000000000000000000006000000 Test Case 5: Enter two integers that are of unequal length nine 9 's and five 5 's. In this case, some of the 1 bits "collided with each other as they occurred in the same position in both binaries. So, they were filtered out, which produce a number slightly less that the larger of the two numbers. Again. most of the 1 bits from both binaries were unmatched in the binary of the other. Test Case 6: Enter two integers that are different from each other by 1 . Notice how the xor result is 3 . The 3 represents the bits that were not 1s in the binary of both numbers. Check it out. The 1 bit is set in the first number and the 2 bit is set in the second number. That is why the xor resulted in a 31+2=3. 7777777 777778 You entered two integers as your input: 7777777777778 Binary bit patterns of inputA and inputB are: e000000001110110101011011110001 60000000011101101010110111110010 >>>>>>>> ENTERTNG xORAB result of XOR bitwise operation (ab) is 3 00000000060000000000000000000011 result of operation using bitwise 8 is is 3 00000000000000000000000000000011 int x just after Ou =1 111111111111111111111111111111 int y just ofter 0u=1 11111111111111111111111111111 max int x=2147483647 o11111111111111111111111111111 most negative (min) int y=2147483648 10000000000000000000000000000000 Test Case 1: Enter two integers, 0 and 0 , as a classic case to test program function, You entered two integers as your input: 00 Binary bit patterns of inputA and inputB are: 00000000000000000000000000000000 00000000000000000000000000000000 ENTERING XORAB result of XOR bitwise operation (ab) is 0 00000000000000000000000000000000 ENTERING andNotSAB result of operation using bitwise is is 00000000000000000000000000000000 ENTERING maxMinInt int x just after u=1 111111111111111111111111111111 int y just after 0u=1 111111111111111111111111111111 max int x=2147483647 max int x=2147483647 most negative (min) int y=2147483648 10000002006000000000000000000000 Test Case 2: Enter integers that are the bitwise opposites of each other to see how XOR works with no bits in any of the positions having the same value when the integers are compared to each other. Notice how the 1s "fall through" to the xor result. There are no 1 bits that are.present in the same position of either binary. . Test Case 3: Test Case 3: Enter two five-digit numbers. Notice how sometimes the xor of two numbers ends up being greater than either. That is because the xor keeps the 1 bits in both binaries as long as there is a 1 in only one of the binaries in a given position. 12345 67890 You entered two integers as your input: 1234567890 Binary bit patterns of inputA and input B are: 00000000000000000011000000111001 00000000000000010000100100110010 result of XOR bitwise operation (a b) is result of operation using bitwise & is is 80139 00000000000000010011100100001011 >>>>>>>>>> ENTERING andNotsAB result of operation using bitwise 8 is is 80139 00000000000000010011100100001011 ENTERING maxMinint int x just ofter 0u=1 1111111111111111111111111111 int y just after 0u=1 11111111111111111111111111111 max int x=2147483647 0111111111111111111111111111 most negative (min) int y=2147483648 10000000000000000000000000000000 Test Case 4: Enter the largest positive signed integer (32-bit) and a number that is all 1s. Both numbers are ten digits in length. The resulting xor integers and binaries will be the same length. Test Case 5: Enter two integers that are of unequal length .. nine 9 's and five 5 's. In this case, some of the 1 bits "collided with each other as they occurred in the same position in both binaries. So, they were filtered out, which produce a number slightly less that the larger of the two numbers. Again, most of the 1 bits from both binaries were unmatched in the binary of the other. Test Case 6: Enter two integers that are different from each other by 1. Notice how the xor result is 3. The 3 represents the bits that were not 1s in the binary of both numbers. Check it out. The 1 bit is set in the first number and the 2 bit is set in the second number. That is why the xor resulted in a 31+2=3. 7777777 7777778 You entered two integers as your input: 77777777777778 Binary bit patterns of inputA and inputB are: 00000060011101101010110111110001 00000600011101101010110111110010 > ENTERING XORAB result of XOR bitwise operation (ab) is 3 00000000000000000000000000000011 >>> ENTERING andNotSAB result of operation using bitwise & is is 3 09000090000000000000000000000011 int x just after u=1 111111111111111111111111111111 int y just after 0u=1 111111111111111111111111111111 max int x=2147483647 0111111111111111111111111111111 most negative (min) int y=2147483648 1000000006000000000000000000000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions