The octal representation of an integer is (342)_8. If this were to be treated as an eight-bit integer in an 2's complement based computer, its decimal equivalent is A. 226 B. -98 C. 76 D. -30

GATE 1998 · Digital Logic · Number Representation · medium

Answer: -30 (option D)

  1. Convert octal to binary: 3 -> 011, 4 -> 100, 2 -> 010. So (342)_8 = 011100010 in binary (9 bits). Take the 8 rightmost bits: 11100010.
  2. Interpret as 8-bit 2's complement: 11100010: MSB=1 so negative. Flip bits: 00011101. Add 1: 00011110 = 16+8+4+2 = 30. So the value is -30.