Aptitude | GATE CS 1998 | Question 17

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


Answer: (D)

Explanation: (342)8=(011100010)2=(11100010)2.
If we treat this as an 8-bit integer, the first bit becomes sign bit and since it is “1”, number is negative. 8085 uses 2’s complement representation for integers and hence the decimal equivalent will be
(00011110)2 = -30
So, option (D) is correct.

Quiz of this Question



My Personal Notes arrow_drop_up

Improved By : sanchikhurana2010