You are on page 1of 1

Ateneo de Davao University

No portion of this module is permitted to be uploaded to other resource sharing platforms.

Module 7.3 Bit Operations

Bits

Bit is short for binary digit. Computers represent information using bits. A bit has two possible
values, 0 and 1, which represent a truth value. As customary done, 1 will be used to represent T and 0 will
be used to represent F.

A bit string is a sequence of zero or more bits. The


length of this string is the number of bits in the string. Hence,
101001100 is a bit string of length 9.

A byte is 8 bits.
A word is 16 bits or 2 bytes.

Decimal and Binary

What is the decimal value of the binary 10110001?

1 → 1 x 2! = 1 x 128 = 128
0 → 0 x 2" = 0 x 64 = 0
1 → 1 x 2# = 1 x 32 = 32
1 → 1 x 2$ = 1 x 16 = 16
0 → 0 x 2% = 0 x 8 = 0
0 → 0 x 2& = 0 x 4 = 0
0 → 0 x 2' = 0 x 2 = 0
1 → 1 x 2( = 1 x 1 = 1

Some Logic Gates

The bitwise OR, bitwise AND, and bitwise XOR of two strings of the same length are defined as
the strings that have as their bits the connectives OR, AND, and XOR of the corresponding bits in the two
strings respectively.

Consider the two bit strings 0110110110 and 1100011101. Find

a. bitwise OR b. bitwise AND c. bitwise XOR

0110110110 0110110110 0110110110


˅ 1100011101 ˄ 1100011101 ⨁1100011101
1110111111 0100010100 1010101011

You might also like