Question

Actually i am preparing for an exam and in the last year exam this que. was been asked. i.e

The maximum decimal integer number that can be stored in memory of 8-bit word processor computer ?

a) (128)10
b) (127)10
c) (129)10
d) (255)10

Answer of this que. as given in the answer key is b) 127. And I have no idea how they arrived at this result.

Acc. to my understanding, we have 8-bits, which is 28 = 256 so 255 should be the maximum integer which we can store.

EDIT - An another very similar que. asked in same exam was

The maximum permissible integer in a computer with n-bit word processor and one word per integer is equal to

a) 2 n - 1 - 1
b) 2 n - 1
c) 2 n - 1 + 1
d) 2 n + 1

Its ans. is a) 2 n - 1 - 1 (acc. to official ans. key).

By putting n = 8 from above que. we got the answer 127. But again i am clueless how did they derived this answer too.

Was it helpful?

Solution

The following is the reasonable verdict, I believe, given no more context, as said by Steven's comment and harold's comment.

The maximum (decimal) integer that can be stored in memory of 8-bit word processor computer depends on the context, that is, whether we are talking about unsigned integers or signed integers.

According to this Wikipedia page on 8-bit computing,

There are $2^8$ (256) different possible values for 8 bits. When unsigned, it has possible values ranging from 0 to 255; when signed, it has -128 to 127.

The natural answer, without no more context, should be $2^8-1=255$. We have not seen any computer processor that interprets an 8-bit sequence (in a basic level, just to be safer) as an integer that is more than 255. On the other hand, almost all computer processor today can interpret an 8-bit sequence as an (unsigned) integer as large as 255 . In fact, as said in this nice answer of Kristian H,

Unsigned numbers are one interpretation of a sequence of bits. It is also the simplest, and most used interpretation internally to the CPU because addresses, and op codes are simply bits. Memory / Stack addressing and arithmetic are the foundations of microprocessor, well, processing. Moving up the abstraction pyramid, another frequent interpretation of bits is as a character (ASCII, Unicode, EBCDIC).


Having said the above, let me come to defend the choice of the author of that exam, even though I would NOT phrase the question and answer suite as presented in the question.

The question in the exam was designed to test a student's basic understanding of the representation of numbers in our binary computer processors.

If a student chooses, presumably for some good reason, "b) (127)10", we can be confident that student knows the very basic about the representation of a signed integer by two's complement. One bit out of that 8 bits must be used to represent the sign. Somehow, the range of positive integers is one less than the range of negative integers. So, the maximum signed integer in 8 bits is $2^{8-1}-1$. We can be confident that student would know the maximum unsigned integer can be represented in 8 bits could be $2^8-1=255$.

However, if a student chooses "d) (255)10", it might be hard to justify that student knows what happens with signed integers. So, if the exam is aimed at checking how much students have learned, choice b) could be appropriate.

So, in the context of an exam, a student would have a better chance to be considered more knowledgeable if choice b) is selected instead of choice d). Or a better chance to gain a better grade.


Once again, let me emphasize harold's verdict, "that is not a reasonable question". Ideally, for the intended choice of b), the question should be "the maximum signed integer that can be stored in memory of 8-bit word processor computer?"


For a detailed explanation of two's complement, please check this Wikipedia page.

OTHER TIPS

I got the same question in my technical informatics exam. The right answer was also 127, my professor explained signed integer is the default format, therefore the range would go from -128 to 127. You can display 256 distinct value, but the maximum would still be 127.

With a single 8-bit word, you can represent 256 different, distinct values. However, there is nothing in the first question that restricts you to use only one word, you can use however many words you like. With two words, you can already represent 65536 values, with 42 words, we could already represent every particle in the universe. Therefore, the maximum integer that can be represented is arbitrarily large, or put another way there is no maximum integer.

The second question restricts you to use a single word, but there is still a problem: we now know, we can only represent 256 distinct values, but the question doesn't tell us anything about how those values are encoded. For example, the ISO8859-1 encoding of characters can represent the international generic currency sign (¤) as one of the 256 values, but it cannot represent the Euro sign (). ISO8859-15 on the other hand, can represent the Euro sign but not the generic currency sign, and neither can represent the Bitcoin currency sign .

The same goes for numbers: with 8 bits and an unsigned unary encoding, I can represent the numbers from 0 to 8. With a signed unary encoding, I can represent the numbers from -7 to +7, including both -0 and +0. With an unsigned unary encoding offset by 42, I can represent the number 42 to 50.

Regardless of whether I use a signed or unsigned, unary, binary, decimal, or some other encoding, I can always represent arbitrarily large numbers by introducing an offset in my encoding.

So, again, also for the second question, it is impossible to give the answer.

To answer the second question, we would need to know the encoding, to answer the first question, we would need to know the encoding and the memory size.

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top