Lab 3 Bit Operators
Name :Harpratap Singh Student ID: 145036208
Marks:1.875
Due: Before the beginning of the next lab . No late labs will be accepted.
Please note that the assignment submission folder will be unavailable after this time.
1) The following table contains a value for number and a value for mask. The AND, OR, and XOR operations
are performed on number and mask. In addition the NOT operation is performed only on the number. For the
values given, find the results expressed as both a Hex and binary number(8-bits) and fill the table with these
results.
number number mask mask AND AND OR OR XO XOR NO NOT
(Hex) binary Hex binary Hex binary Hex binary R binary T binary
Hex He
x
0x00 00000000 0x0f 00001111 00 00000000 0f 00001111 0f 00001111 ff 11111111
0x11 00010001 0x0f 00001111 01 00000001 1f 00011111 1e 00011110 ee 11101110
0x22 00100010 0x0f 00001111 02 00000010 2f 00101111 2d 00101101 dd 11011101
0x44 01000100 0x0f 00001111 04 00000100 4f 01001111 4b 01001011 bb 10111011
0x88 10001000 0x0f 00001111 08 00001000 8f 10001111 87 10000111 77 01110111
0xff 11111111 0x0f 00001111 0f 00001111 ff 11111111 f0 11110000 00 00000000
0x00 00000000 0x22 00100010 00 00000000 22 00100010 22 00100010 ff 11111111
0x11 00010001 0x22 00100010 00 00000000 33 00110011 33 00110011 ee 11101110
0x22 00100010 0x22 00100010 22 00100010 22 00100010 00 00000000 dd 11011101
0x44 01000100 0x22 00100010 00 00000000 66 01100110 66 01100110 bb 10111011
0x88 10001000 0x22 00100010 00 00000000 aa 10101010 aa 10101010 77 01110111
0xff 11111111 0x22 00100010 22 00100010 ff 11111111 dd 11011101 00 00000000
Complete the following table
Truth Tables
Y X Y Y Y NOT NOT
AND OR XOR Y X
X X X
0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 0 1
1 1 1 1 0 0 0
2) What is an array?
Arrays allow a programmer to access several variables through a single variable name. An array can hold one or
more variables of a common type
PRG255 061 1