Data and Program Representation
Data and Program Representation
Data these are raw facts and figures that are inserted into a computer and are processed to form
information.
Digital logic circuits contain many low level details. The circuits use transistors and electrical
voltage to perform basic operations.
Abstracting means that complex digital systems, such as memories and processors, can be
described without thinking about individual transistors or voltage.
To a programmer, the most important abstractions are the items visible to software the
representations used for data and programs.
Bit- is used to describe an entity that can have two possible values, and assign the mathematical
names 0 and 1 for the two values.
Multiple bits are used to represent more complex data items. For example each computer system
defines a byte to be the smallest data item larger than a bit that the hardware can manipulate. The
size of the byte is not standard it was determined by the constructors of the computer.
The number of bits per byte is especially important to programmers because memory is
organized as sequence of bytes.
The size of the byte determines the maximum numerical value that can be stored in one byte.
A byte that contains k bits can represent one of 2k values (i.e. exactly 2k unique strings of 1s and
0s exist that have length k).
A six byte can represent 64 possible values, and an eight bit can represent 256 possible
values.E.g consider the eight possible combinations that can be achieved with three bits.
One of the most common abstractions used to associate a meaning with each combination of bits
interprets them as numeric value.e.g an integer interpretation is taken from mathematics; bits are
values in positional number system that uses bases two.
To understand the interpretation, remember that in base 10,then the possible digits are
0,1,2,3,4,5,6,7,8 and 9 each position represents a power of 10,and the number 123 represents 1
times 102 plus 2 times 101 plus 3 times 100.
In binary system, the possible digits are 0 and 1 and bits position represents a power of two. That
is the position represent successive powers of two: 20, 21, 22 and so on.
The value associated with each of the first six bit positions when using a positional interpretation
in base two.
A set of k bits can be interpreted to represent a binary integer. When convectional positional
notation is used, the values that can be used, the values that can be represented with k bits range
from 0 through 2-1.
BIT ORDERING.
When writing decimal numbers, we always write the Keats significant digit on the right and the
most significant digit on the left.
When writing binary, it makes sense to write the least significant Bit (LSB) on the right and the
most significant Bit (MSB) on the left.
The idea of ordering is important when the bits are transferred from one location to another.E.g
when a numeric value is moved between a register and memory, the bit ordering must be
preserved.
HEXADECIMAL NOTATION.
A binary number can be translated to an equivalent decimal number programmers and engineers
sometimes find the decimal equivalent difficult to understand.
To aid humans in expressing binary values, a comprise has been reached a positional numbering
system with a larger base. Base eight (known as octal) has been used but base sixteen (known as
hexadecimal) has become popular.
The representation is substantially more compact than binary, the resulting strings are shorter.
Sixteen is a power of two, conversion between binary and hexadecimal is and does not involve a
complex arithmetic calculation.
Hexadecimal encodes each group of four bits as a single hex digit between zero and fifteen.
The digits used in binary, decimals and hexadecimals number systems overlap, constant can be
ambiguous. To solve the ambiguity an alternate notation is needed .Mathematicians and some
textbooks add a subscript to denote a base other than ten.
CHARACTER SETS.
Computer system defines a character set to be a set of symbols that the computer and I/O devices
agree to use. A typical character set contains uppercase and lowercase letters, digits and
punctuation marks.
Computer architects often choose a character set such that each character set such that each
character fits into byte.
The relationship between the byte size and the character set is so strong that many programming
languages refer to a byte as a character.
In 1960 IBM Corporation chose the extended binary coded decimal interchange code recreation
as the character set used on IBM computers.
CDC Corporation chose a six-bit character set for use on their computers. The two character sets
were completely incompatible. To help vendors build compatible equipment, the American
national standards institute defined a character representation know ASCII.
The ASCII character set specifies the representation of 128 characters, including the usual
letters, digit and punctuation marks. Additional values in an eight-bit byte can be assigned for
special symbols. The standard is widely accepted.
A seven-bit character set and an eight-bit byte work well for English and some European
languages. Unicode extends ASCII AND is intended to accommodate all languages.