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.

  • $\begingroup$ Is the number signed or unsigned (hint) $\endgroup$ Apr 7, 2020 at 10:56
  • $\begingroup$ There is no mention about the signed or unsigned number. The que. is asked in exam as it is given above. No other detail is given. $\endgroup$
    – harry
    Apr 7, 2020 at 11:01
  • 2
    $\begingroup$ You can represent up to $256$ distinct values. The actual set of values (and hence its maximum element) depends on your encoding. The question is probably assuming that integers are signed and stored using two's complement. See also this Wikipedia page. $\endgroup$
    – Steven
    Apr 7, 2020 at 11:06
  • 2
    $\begingroup$ That is not a reasonable question IMO. Answer could be b or d depending on signedness which the question apparently neglected to specify. $\endgroup$
    – user555045
    Apr 7, 2020 at 11:38
  • 1
    $\begingroup$ The Correct answer for both questions is that there is not enough information to answer the question. $\endgroup$ Apr 8, 2020 at 9:27

4 Answers 4


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.

  • $\begingroup$ Long Nguyen's professor believes that signed integer is the default format. That could be a strong and better defense for the exam. However, as @PeterJ says, "there are no defaults at a machine code level, most assemblers I'm aware of are fine with defining a byte value of 255". $\endgroup$
    – John L.
    Apr 7, 2020 at 14:40
  • $\begingroup$ Thanks 'John' for this beautiful answer. I got it. I highly appreciate your efforts behind the answer. It will be more helpful for me if you can please explain the term "one word per integer". It was used at the end of 2nd que. (written in EDIT of original que. ) $\endgroup$
    – harry
    Apr 7, 2020 at 17:15
  • $\begingroup$ Professor is of course completely wrong. The largest integer that can be stored in 8 bits is 255. The largest signed integer is 127. $\endgroup$
    – gnasher729
    Apr 7, 2020 at 17:56
  • $\begingroup$ @harry, "one word per integer", for "n-bit word", means simply $n$ bits are used to represent an integer. It happens often that multiple words or a fraction of a word may be used to represent an integer. Just in case that you are not aware, please note here the word "word" has a particular meaning. $\endgroup$
    – John L.
    Apr 7, 2020 at 19:08
  • $\begingroup$ @harry, indeed, "one word per integer" in the second que. should be added to the first que. as well for better rigor, since some 8-bit word processors can certainly store an integer as large as $2^{15}-1$ or even much larger in memory, using two or more words. $\endgroup$
    – John L.
    Apr 7, 2020 at 19:20

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.

  • $\begingroup$ Can we generalize it to 2^ (n - 1) - 1 , for n-bits. $\endgroup$
    – harry
    Apr 7, 2020 at 12:33
  • 1
    $\begingroup$ yes, you can. If you are interested, there is a very famous problem with unix en.wikipedia.org/wiki/Year_2038_problem. Unix was initially implemented with a time system based on signed 32-bit Integer, which will result in an overflow in the year 2038. $\endgroup$ Apr 7, 2020 at 12:37
  • 3
    $\begingroup$ You might want to ask your professor where it's a default, IMO there are no defaults at a machine code level, most assemblers I'm aware of are fine with defining a byte value of 255 and I'm pretty sure the C programming language leaves whether a char is signed or unsigned as implementation specific. $\endgroup$
    – PeterJ
    Apr 7, 2020 at 12:45

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 -3 to +3, including both -0 and +0. With an unsigned unary encoding offset by 42, I can represent the numbers 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.


In 8 bits the total number of integers that we can store are 256 i.e -128 - 127 including zero in positive.

For representation of positive numbers the MSB(Most Significant bit) is always zero 01111111 and for negative numbers the MSB remains 1.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.