In the world of computers, everything you see, hear, or interact with is ultimately stored and processed as data. But how does a computer understand and manage this data? The answer lies in how data is represented inside the computer using the smallest units called bits and bytes. Understanding these basic units and how data is represented using different number systems is crucial for anyone preparing for competitive exams and for building a strong foundation in computer knowledge.
This section will guide you through the fundamental concepts of bits and bytes, the binary number system, conversions between number systems, and how data sizes are measured. By the end, you will be comfortable with these concepts and ready to solve related problems efficiently.
Let's start with the very basics. A bit is the smallest unit of data in a computer. The word "bit" stands for binary digit. It can have only one of two values: 0 or 1. These two values represent the simplest form of data, much like a light switch that can be either off (0) or on (1).
Why only 0 and 1? Because computers use electronic circuits that are either off or on, making binary the natural language of computers.
Now, a byte is a group of 8 bits. Think of a byte as a small container that holds 8 bits together. This grouping allows computers to represent more complex data like characters, numbers, and symbols.
Each bit in a byte has a position, and together they can represent numbers from 0 to 255 (which is \(2^8 - 1\)). This is why bytes are fundamental for storing data like letters, numbers, and more.
When dealing with larger amounts of data, we use bigger units based on bytes. These units use metric prefixes similar to those in the metric system (like kilo, mega, giga). Here are the common data units:
Note: Sometimes, in computer science, binary prefixes are used (where 1 KB = 1024 bytes), but for most competitive exams and general understanding, the metric system (powers of 10) is used.
The binary number system is the foundation of all data representation in computers. Unlike the decimal system (base-10) that uses digits 0 through 9, the binary system (base-2) uses only two digits: 0 and 1.
Each digit in a binary number is called a bit, and each bit has a place value based on powers of 2, starting from the rightmost bit (least significant bit) which has a place value of \(2^0 = 1\).
| Place Value (Decimal) | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | \(2^7\) | \(2^6\) | \(2^5\) | \(2^4\) | \(2^3\) | \(2^2\) | \(2^1\) | \(2^0\) |
| Binary Digit | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
For example, the binary number 10011010 can be understood by adding the place values of the bits set to 1:
\(1 \times 128 + 0 \times 64 + 0 \times 32 + 1 \times 16 + 1 \times 8 + 0 \times 4 + 1 \times 2 + 0 \times 1 = 128 + 0 + 0 + 16 + 8 + 0 + 2 + 0 = 154\)
To work effectively with computers, you need to convert numbers between different systems: decimal (base-10), binary (base-2), octal (base-8), and hexadecimal (base-16). Each system has its own uses:
Let's look at the general steps for two common conversions:
graph TD A[Start with Decimal Number] --> B[Divide by 2] B --> C[Record Remainder (0 or 1)] C --> D{Is Quotient 0?} D -- No --> B D -- Yes --> E[Read Remainders in Reverse Order] E --> F[Binary Number Obtained] G[Start with Binary Number] --> H[Assign Place Values (2^0, 2^1, ...)] H --> I[Multiply each bit by its place value] I --> J[Sum all values] J --> K[Decimal Number Obtained]To convert a decimal number to binary:
To convert a binary number to decimal:
Understanding bits, bytes, and number systems is not just theoretical. It helps in:
Step 1: Divide 156 by 2.
156 / 2 = 78, remainder = 0
Step 2: Divide 78 by 2.
78 / 2 = 39, remainder = 0
Step 3: Divide 39 by 2.
39 / 2 = 19, remainder = 1
Step 4: Divide 19 by 2.
19 / 2 = 9, remainder = 1
Step 5: Divide 9 by 2.
9 / 2 = 4, remainder = 1
Step 6: Divide 4 by 2.
4 / 2 = 2, remainder = 0
Step 7: Divide 2 by 2.
2 / 2 = 1, remainder = 0
Step 8: Divide 1 by 2.
1 / 2 = 0, remainder = 1
Step 9: Read remainders from bottom to top:
10011100
Answer: Decimal 156 = Binary 10011100
101101 into its decimal equivalent. Step 1: Write place values for each bit (from right to left):
\(2^5 = 32\), \(2^4 = 16\), \(2^3 = 8\), \(2^2 = 4\), \(2^1 = 2\), \(2^0 = 1\)
Step 2: Multiply each bit by its place value:
\(1 \times 32 = 32\)
\(0 \times 16 = 0\)
\(1 \times 8 = 8\)
\(1 \times 4 = 4\)
\(0 \times 2 = 0\)
\(1 \times 1 = 1\)
Step 3: Add all values:
32 + 0 + 8 + 4 + 0 + 1 = 45
Answer: Binary 101101 = Decimal 45
1A3 to its decimal equivalent. Step 1: Write the place values for each digit (right to left):
\(16^2 = 256\), \(16^1 = 16\), \(16^0 = 1\)
Step 2: Convert hex digits to decimal:
1 = 1, A = 10, 3 = 3
Step 3: Multiply each digit by its place value:
\(1 \times 256 = 256\)
\(10 \times 16 = 160\)
\(3 \times 1 = 3\)
Step 4: Add all values:
256 + 160 + 3 = 419
Answer: Hexadecimal 1A3 = Decimal 419
Step 1: Recall that 1 MB = \(10^6\) bytes = 1,000,000 bytes.
Step 2: Divide the file size by 1,000,000:
\(5,000,000 \div 1,000,000 = 5\)
Answer: The file size is 5 MB.
725 to its binary equivalent. Step 1: Convert each octal digit to 3-bit binary:
Step 2: Combine the binary groups:
111 010 101
Answer: Octal 725 = Binary 111010101
When to use: During quick conversions between number systems to save time.
When to use: When converting decimal numbers to binary manually.
When to use: To simplify conversions between binary and octal/hexadecimal.
When to use: While calculating or converting storage sizes.
When to use: Before and during competitive exams.
Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.
Go to practice →