Skip to content
GK24
GK NotesComputer AwarenessNumber Systems and Data Representation

Number Systems and Data Representation in Computers

Number Systems notes for competitive exams: binary, octal and hexadecimal conversions, bits, bytes and storage units, ASCII, EBCDIC, BCD, Unicode and complements.

By · Published · 5 min read

Number Systems and Data Representation in Computers — GK24 title card
Number Systems and Data Representation in Computers — GK24 title card

Every piece of information inside a computer, whether it is a letter you type, a photograph, a song or an instruction of a program, is finally stored as a pattern of two states: current flowing or not flowing, magnetised or not magnetised, a pit or a land on a disc. That is why the machine counts in the binary number system instead of the decimal system people use. This chapter explains how the decimal number 25 becomes 11001, how eight such digits make one byte, and how the letter A becomes the number 65 inside memory. Examiners in SSC, Railway and Banking papers set questions from it every year because a single conversion can be asked and marked in one line.

Base, radix and positional value

A number system is defined by its base, also called its radix, which is simply the count of different digits it uses. The decimal system has base 10 because it uses ten digits, 0 to 9. In every positional system the value of a digit depends on the place it occupies, and each place is worth the base raised to a power that grows from right to left, beginning at zero. In decimal 345 the 3 stands for 3 x 10², the 4 for 4 x 10¹ and the 5 for 5 x 10⁰. The same rule works in every base. The binary number 1011 therefore means 1 x 2³ + 0 x 2² + 1 x 2¹ + 1 x 2⁰, which is 11 in decimal. One fact settles many objective questions: the largest digit of a system is always one less than its base, so 8 and 9 can never appear in an octal number.

The four number systems used in computing

SystemBaseDigits usedExample
Binary20, 11011
Octal80 to 7627
Decimal100 to 9345
Hexadecimal160 to 9 and A to F2AF

Hexadecimal borrows the letters A, B, C, D, E and F to stand for the decimal values 10, 11, 12, 13, 14 and 15, because no single symbol exists for them. Octal and hexadecimal are used as shorthand: they pack long strings of bits into a few readable characters, which is why memory addresses and colour codes are written in hexadecimal.

Converting from one system to another

  • Decimal to binary: divide the number by 2 again and again, note each remainder, and read the remainders from the bottom upwards. Dividing 25 gives remainders 1, 0, 0, 1, 1, so 25 is 11001.
  • Binary to decimal: multiply each bit by its place value and add. For 11001 that is 16 + 8 + 0 + 0 + 1, again 25.
  • Binary to octal: make groups of three bits from the right and write the decimal value of each group, because 2³ equals 8. So 110 010 111 becomes 627.
  • Binary to hexadecimal: make groups of four bits from the right, because 2⁴ equals 16. So 1110 becomes E.
  • Octal to hexadecimal: there is no direct method worth remembering; expand the octal number into binary, regroup the bits in fours and read the hexadecimal digits.

Bit, byte and the units of storage

A bit, short for binary digit, is one 0 or one 1 and is the smallest unit of data. Four bits make a nibble and eight bits make a byte, the unit in which one character is normally stored. Larger units go up in steps of 2¹⁰, that is 1024, and not 1000, which is the trap examiners use.

UnitEqualsIn bytes
Nibble4 bitsHalf a byte
Byte8 bits1
Kilobyte (KB)1024 bytes2¹⁰
Megabyte (MB)1024 KB2²⁰
Gigabyte (GB)1024 MB2³⁰
Terabyte (TB)1024 GB2⁴⁰

How characters and pictures are coded

Numbers are stored in binary directly, but letters and symbols need a code that fixes which pattern of bits stands for which character. Standard ASCII, the American Standard Code for Information Interchange, uses seven bits and therefore covers 128 characters; the capital letter A is 65, the small letter a is 97 and the digit character 0 is 48. Extended ASCII adds an eighth bit and reaches 256 characters. EBCDIC, an eight-bit code from IBM, was used on mainframes. BCD, or Binary Coded Decimal, stores each decimal digit separately in four bits, so 25 is written 0010 0101. Unicode was created so that every script in the world, Devanagari included, could be represented; its first 128 code points are the same as ASCII, which keeps old files readable. A picture is stored as a grid of pixels, each pixel holding the intensity of red, green and blue, and a sound as thousands of numbered samples per second.

Binary arithmetic and complements

Binary addition follows four rules: 0 + 0 is 0, 0 + 1 is 1, 1 + 0 is 1, and 1 + 1 is 0 with a carry of 1. Subtraction is usually not done directly; computers turn it into addition using complements. The 1's complement of a binary number is obtained by changing every 0 to 1 and every 1 to 0. The 2's complement is the 1's complement plus one, and it is the standard way of storing negative numbers, because the same adder circuit then handles both addition and subtraction. In a signed binary number the leftmost bit, called the most significant bit, is the sign bit: 0 marks a positive number and 1 a negative one. An unsigned group of eight bits can hold the values 0 to 255, since 2⁸ is 256.

Exam Point of View

Examiners ask five things from this chapter. First, straight conversions: decimal to binary, binary to octal in groups of three and binary to hexadecimal in groups of four. Second, the base and the allowed digits, usually as a question asking which number is not a valid octal or binary number. Third, the units, where the trap is answering 1000 instead of 1024 for a kilobyte, and confusing nibble with byte. Fourth, the coding schemes: the bit width of ASCII, EBCDIC and Unicode, the number of characters each covers, and the ASCII values of A, a and 0. Fifth, complements, where candidates take the 1's complement and forget to add one. Expect one question from this chapter in almost every Computer Awareness section, and check whether the question wants the count of patterns, which is 256, or the largest value, which is 255.

Important Facts

Base of binary2, using only the digits 0 and 1
Base of octal8, using the digits 0 to 7
Base of hexadecimal16, using 0 to 9 and A to F
Value of hexadecimal A to F10, 11, 12, 13, 14 and 15
Nibble4 bits, half a byte
Byte8 bits, normally one character
One kilobyte1024 bytes, that is 2 raised to the power 10
Standard ASCII7-bit code, 128 characters
Extended ASCII and EBCDIC8-bit codes, 256 characters; EBCDIC is from IBM
ASCII value of A, a and 065, 97 and 48
Bits per octal and hexadecimal digit3 bits and 4 bits
2's complement1's complement plus one
Range of an unsigned byte0 to 255, since 2 raised to the power 8 is 256
Sign bitThe most significant bit; 0 for positive, 1 for negative

Practice MCQs on this topic

Q9.Computer AwarenessMedium

Standard ASCII uses how many bits to represent one character?

  1. A.6
  2. B.7
  3. C.8
  4. D.16
Show answer
Correct answer: B. 7

ASCII stands for American Standard Code for Information Interchange. In its standard form it is a seven-bit code, so it can represent 2 raised to the power 7, that is 128 different characters: the English capital and small letters, the ten digit symbols, punctuation marks and a set of control…

Frequently Asked Questions

Why do computers use the binary number system?

A digital circuit can reliably tell apart only two states, such as a voltage being present or absent, or a spot on a disc being magnetised or not. Two states map naturally onto the two digits 0 and 1, so binary is the cheapest and least error-prone way to store and move data. A system with ten states would need ten different voltage levels and would misread them constantly.

How many bytes are there in one kilobyte, 1000 or 1024?

In computing a kilobyte is 1024 bytes, because memory is addressed in powers of two and 1024 is 2 raised to the power 10. The figure 1000 belongs to the decimal kilobyte used by disc manufacturers on packaging, which is why an advertised 500 GB disc shows less capacity on screen. In examinations, take one kilobyte as 1024 bytes.

What is the difference between ASCII and Unicode?

Standard ASCII is a seven-bit code with 128 characters and covers only English letters, digits, punctuation and control codes. Unicode was designed to hold every writing system in the world, including Devanagari, Tamil and Chinese, and gives each character a unique code point. The first 128 Unicode code points are identical to ASCII, so plain English text remains readable in both.

How do I convert a binary number to hexadecimal quickly?

Make groups of four bits starting from the rightmost bit, adding leading zeros to complete the last group, and replace each group by its hexadecimal symbol. The group 1110 becomes E and 1010 becomes A, so 10101110 becomes AE. The method works because four bits give sixteen combinations, exactly the number of hexadecimal symbols.

Why do computers store negative numbers in 2's complement form?

In 2's complement form, subtracting a number is the same as adding its complement, so the processor needs only one adder circuit instead of separate adding and subtracting hardware. It also gives a single pattern for zero, unlike the 1's complement method which has both a positive and a negative zero.

Sources

  • Computer Science, Textbook for Class XI, Unit 1: Computer Systems and Organisation — NCERT
  • The Unicode Standard, Chapter 2: General Structure — Unicode Consortium
  • ANSI X3.4, Coded Character Set, 7-Bit American National Standard Code for Information Interchange — American National Standards Institute
View all