The octal representation of an integer is (342)8. If this were to be t...
If we treat this as an 8 bit integer, the first bit becomes sign bit and since it is "1", number is negative. Computer uses 2's complement representation for negative numbers and hence the decimal equivalent will be
View all questions of this test
The octal representation of an integer is (342)8. If this were to be t...
Octal to Decimal Conversion:
To convert an octal number to decimal, we need to multiply each digit of the octal number with 8 raised to the power of its position from the rightmost digit. Then, we add all the products to get the decimal equivalent of the octal number.
Given octal number is (342)8
So, (342)8 = 3 × 8² + 4 × 8¹ + 2 × 8⁰ = 192 + 32 + 2 = 226
Hence, the decimal equivalent of the given octal number is 226.
Eight-bit Integer in 8085 based Computer:
An eight-bit integer can store a range of numbers from 0 to 255 in binary form. In two's complement representation, the range of numbers is from -128 to 127.
Since the decimal equivalent of the given octal number is 226, which is greater than 127, we need to represent it in two's complement form to fit it into an eight-bit integer in an 8085 based computer.
To convert a positive decimal number to two's complement form, we need to represent the number in binary form and then take its one's complement by changing all 0's to 1's and all 1's to 0's. Then, we add 1 to the one's complement to get the two's complement.
Binary representation of 226 is 11100010.
One's complement of 11100010 is 00011101.
Adding 1 to the one's complement, we get the two's complement as 00011110.
Hence, the two's complement representation of 226 in an eight-bit integer in an 8085 based computer is 00011110.
Decimal Equivalent of Two's Complement:
To find the decimal equivalent of a two's complement number, we need to first check its leftmost bit. If the leftmost bit is 0, then the number is positive and its decimal equivalent is the same as its binary representation. If the leftmost bit is 1, then the number is negative and its decimal equivalent is obtained by taking its one's complement, adding 1 to the one's complement, and then multiplying the result by -1.
In the two's complement representation of 226, the leftmost bit is 0, which means the number is positive.
Hence, the decimal equivalent of the given octal number treated as an eight-bit integer in an 8085 based computer is 226.
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).