Skip to main content

Back to the full dot-point answer

SingaporeComputer ScienceQuick questions

Data Representation

Quick questions on Two's complement integers explained: H2 Computing

6short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is negating a number?
Show answer
To form the negative of any two's complement number: invert every bit, then add one. The same procedure undoes itself, so it converts +x+x to x-x and x-x back to +x+x.
What is the representable range?
Show answer
For nn bits the range is asymmetric:
What is detecting overflow?
Show answer
Signed overflow happens when adding two numbers of the same sign produces a result of the opposite sign. Equivalently, overflow occurred if the carry into the sign bit differs from the carry out of it. Adding numbers of opposite signs can never overflow.
What is q1?
Show answer
Represent 1-1 in 8-bit two's complement. [2 marks]
What is q2?
Show answer
State the range of a 16-bit two's complement integer. [1 mark]
What is q3?
Show answer
Does adding 0111111101111111 and 0000000100000001 (8-bit signed) overflow? Explain. [2 marks]

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages