Number systems in networking — convert binary to decimal and hexadecimal What are the decimal and hexadecimal equivalents of the 8-bit binary value 10110111 (commonly seen in subnet masks, flags, and protocol fields)?

Difficulty: Easy

Correct Answer: 183/B7

Explanation:


Introduction / Context:
Networking engineers routinely move between binary, decimal, and hexadecimal when reading packet headers, subnet masks, and hardware addresses. Converting a binary octet such as 10110111 to its decimal and hexadecimal forms strengthens your ability to parse protocol values quickly in tools like Wireshark and router CLIs.


Given Data / Assumptions:

  • Binary value: 10110111 (8 bits).
  • We must produce decimal and hexadecimal equivalents.
  • Standard positional notation applies: bit weights 128, 64, 32, 16, 8, 4, 2, 1.


Concept / Approach:
For decimal, sum the powers of two where the bit is 1. For hexadecimal, group the 8 bits into two 4-bit nibbles, convert each nibble to a hex digit, and combine. Hex shorthand is widely used in documentation (for example, 0xB7).


Step-by-Step Solution:
Write bit weights: 128 64 32 16 8 4 2 1.Map the bits: 1 0 1 1 0 1 1 1.Add positions with 1s: 128 + 32 + 16 + 4 + 2 + 1.Compute decimal: 128 + 32 = 160; 160 + 16 = 176; 176 + 4 = 180; 180 + 2 = 182; 182 + 1 = 183.Group into nibbles: 1011 0111.Convert each nibble: 1011 = B, 0111 = 7.Hex value: B7 (or 0xB7).


Verification / Alternative check:
Use a quick mental check: 183 is close to 192 (11000000). Since 10110111 differs by 9 from 11000000, 192 - 9 = 183, consistent with our sum. For hex, confirm that 0xB7 = 11*16 + 7 = 176 + 7 = 183.


Why Other Options Are Wrong:

  • A: 69/0x2102 mixes unrelated router register notation and wrong conversion.
  • C: 173/A6 is inconsistent; A6 hex equals 166 decimal, not 173.
  • D: 83/0xC5 mismatches both bases for the given bits.
  • E: 97/0x61 corresponds to 01100001, not 10110111.


Common Pitfalls:
Forgetting to group nibbles from the left, or misreading bit weights (especially 16 vs. 32). Always double-check with a quick hex-to-decimal recomputation.


Final Answer:
183/B7

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion