Welcome back, future Indian Statistical Service (ISS) officers!
In our previous article, we navigated the invisible intelligence of the computer system: The Operating System (OS). We explored how the OS acts as a master manager, allocating the CPU using scheduling algorithms like Round Robin and FCFS. However, when the CPU finally receives a process to execute, how does it actually crunch the data?
Computers do not understand English, Hindi, or standard decimal mathematics. At the hardware level, they process everything in states of electrical voltage, essentially “On” and “Off.” This brings us to a highly scoring, purely numerical segment of the UPSC ISS Paper I syllabus: Number Systems and Computer Codes.
Every year, the UPSC tests candidates on their ability to convert numbers between Decimal, Binary, Octal, and Hexadecimal systems. Because this section is strictly mathematical, it offers a guaranteed opportunity to score full marks. Today, we will break down the mechanics of computer math and learn the professional techniques required to solve these conversions accurately and swiftly.
The Core Number Systems
To process data efficiently, computer scientists developed various positional number systems. A positional number system uses a specific “base” (or radix) to represent values, meaning the position of each digit determines its actual weight.
As a professional preparing for the ISS exam, you must be thoroughly familiar with the following four systems:
- Decimal System (Base 10): This is the standard system used by human beings. It uses 10 unique symbols (0 through 9).
- Binary System (Base 2): This is the fundamental language of the computer hardware. It uses only 2 symbols: 0 and 1. Every piece of data in a computer is ultimately reduced to binary.
- Octal System (Base 8): This system uses 8 symbols: 0 through 7. Notice that the digits 8 and 9 are completely invalid in an octal number.
- Hexadecimal System (Base 16): This system uses 16 symbols. It uses the digits 0 through 9 to represent values from zero to nine, and the uppercase letters A, B, C, D, E, and F to represent the decimal values 10 through 15 respectively.
The Art of Conversion: The Grouping Technique
UPSC frequently asks candidates to convert a number from one base to another. While converting to Decimal requires multiplying by positional weights, converting between Binary, Octal, and Hexadecimal is much faster using the Grouping Technique.
Because 8=23, every Octal digit translates perfectly into a 3-bit binary sequence. Because 16=24, every Hexadecimal digit translates perfectly into a 4-bit binary sequence.
Example: Converting Octal (6251)8 to Hexadecimal
- Octal to Binary: Write the 3-bit binary equivalent for each octal digit.
- 6=110
- 2=010
- 5=101
- 1=001
- Combined Binary: 110010101001
- Binary to Hexadecimal: Regroup this combined binary sequence into blocks of 4 bits, starting from the right (Least Significant Bit).
- 1100=12=C
- 1010=10=A
- 1001=9=9
- Final Answer: (CA9)16.
Signed Numbers and 2’s Complement
In everyday mathematics, we use a minus sign (−) to denote a negative number. However, a computer memory can only store 0s and 1s; it cannot store a physical “−” sign. To represent negative numbers, computers use specific coding methods, the most prominent being the 2’s Complement System.
The UPSC often asks for the 2’s complement representation of a negative decimal number. To find it, follow these professional steps:
- Find the standard binary representation of the positive version of the number.
- 1’s Complement: Invert all the bits (change every 0 to 1, and every 1 to 0).
- 2’s Complement: Add 1 to the resulting 1’s complement.
Example: Represent −59 in an 8-bit 2’s complement system.
- Positive 59 in 8-bit binary: 00111011
- 1’s Complement (invert bits): 11000100
- Add 1: 11000100+1=11000101.
Computer Codes: BCD and Gray Code
Beyond pure number bases, computers use specialized encoding systems to handle data:
- Binary Coded Decimal (BCD): In the standard 8421 BCD system, each individual decimal digit is converted into a 4-bit binary sequence. For example, the decimal number 85 is not converted as a whole. Instead, 8 becomes 1000 and 5 becomes 0101. The BCD representation is 10000101.
- Gray Code: This is a special unweighted code where successive numbers differ from each other by only one bit. To convert a binary number to Gray code:
- The Most Significant Bit (MSB) remains the same.
- Add adjacent binary bits to get the next Gray code bit (ignoring any carry)
The Professional “Elimination Technique”
When solving multiple-choice questions in the UPSC ISS exam, you can often save valuable time by identifying invalid numbers based on their base rules.
- Octal Elimination: An octal number only uses digits 0-7. If an option contains an ‘8’ or ‘9’ (e.g., 3848), you can instantly eliminate it as invalid.
- Hexadecimal Elimination: A hexadecimal number only uses digits 0-9 and letters A-F. If an option contains letters like ‘G’, ‘H’, or ‘O’, it is immediately incorrect. For example, ‘0F6’ is a valid hexadecimal, but ‘0G6’ is impossible.
Professional Analysis of UPSC ISS Previous Year Questions (PYQs)
Let us solidify this mathematical theory by applying it directly to 5 official UPSC ISS PYQs.
PYQ 1 Consider the following statements:
I. The hexadecimal equivalent of octal number 366 is 0F6.
II. The decimal equivalent of hexadecimal number A53 is 2643.
Which of the statements given above is/are correct?
(a) I only (b) II only (c) Both I and II (d) Neither I nor II
Professional Analysis: Let us evaluate Statement I using the grouping technique:
Octal 366→ Binary: 011 110 110. Grouping into 4s from the right: 0000 1111 0110→0 F 6. Statement I is correct.
Let us evaluate Statement II using positional weights: A53→(10×162)+(5×161)+(3×160)=2560+80+3=2643. Statement II is correct.
Correct Answer: (c) Both I and II.
PYQ 2 What is the equivalent hexadecimal number of the octal number 6251?
(a) 9CA (b) AC9 (c) DB9 (d) CA9
Professional Analysis: We convert the octal digits to a 3-bit binary sequence: 6→110, 2→010, 5→101, 1→001. The combined binary is 110010101001. We regroup this into 4-bit sections for Hexadecimal: 1100 1010 1001. Translating these blocks gives C (12), A (10), and 9. Thus, the answer is CA9.
Correct Answer: (d) CA9.
PYQ 3 What is the representation of −59in the 8-bit 2’s complement system?
(a) 11000101 (b) 11000100 (c) 10000101 (d) 11000001
Professional Analysis: Step 1: Write +59 in 8-bit binary →00111011. Step 2: Find the 1’s complement by inverting the bits →11000100. Step 3: Add 1 to find the 2’s complement →11000100+1=11000101.
Correct Answer: (a) 11000101.
PYQ 4 Binary equivalent of Gray coded number 10101110will be:
(a) 10101110 (b) 11011000 (c) 11001011 (d) 01010001
Professional Analysis: To convert Gray code (10101110) back to binary, the MSB remains the same (1). The next binary bit is the addition of the current binary bit and the next Gray bit (ignoring carry). B1=1. B2=B1+G2=1+0=1. B3=B2+G3=1+1=0 (carry ignored). B4=B3+G4=0+0=0. B5=B4+G5=0+1=1. B6=B5+G6=1+1=0. B7=B6+G7=0+1=1. B8=B7+G8=1+0=1. The resulting binary sequence is 11001011.
Correct Answer: (c) 11001011.
PYQ 5 In hexadecimal system, the binary number (111110111.110101)2 is equivalent to:
(a) (2F7.C4)16 (b) (1F7.D5)16 (c) (1F7.D4)16 (d) (2F7.D4)16
Professional Analysis: We split the number at the radix point and group into 4s. For the integer part (111110111), pad with leading zeros: 0001 1111 0111→1 F 7. For the fractional part (.110101), pad with trailing zeros: .1101 0100→. D 4. Combining them yields (1F7.D4)16.
Correct Answer: (c) (1F7.D4)16.
What Lies Ahead?
In this sixth installment of our Computer Series for UPSC ISS, we demystified the mathematical core of computers. You now have the professional toolkit to effortlessly shift between Decimal, Binary, Octal, and Hexadecimal formats, and you understand exactly how negative numbers are manipulated using the 2’s complement technique.
Up to this point, we have treated the computer as an isolated machine, looking at its CPU, its memory, its software, and its internal mathematical logic. However, in today’s modern era, computers rarely operate in isolation. They are constantly communicating with each other, sharing data across the globe.
How do multiple computers connect to share resources? What is the difference between a Star and a Bus structure? In Part 7, we will expand our scope and dive into Computer Networks & Local Topologies. We will decode LANs, WANs, and the physical network architectures (Bus, Star, Ring, Mesh) that are a staple in the UPSC ISS examination. Keep practicing your numerical conversions, and get ready to network!
(Have a specific doubt about Hexadecimal conversions, the Grouping Technique, or calculating the 2’s complement of a negative number? Drop it in the comments below!)