OA. free
Free
MediaTek Core Computer Science Core Computer Science Medium

When 2 N-bit binary numbers are added, the sum will contain at most:

MediaTek technical mcq question, verified with a worked answer. Free to practise - no sign-up.

When 2 N-bit binary numbers are added, the sum will contain at most:

Choose one option.
Show answer & explanation
Answer: B. B) N+1 bits

Adding two N-bit integers can produce a maximum value of 2*(2^N - 1) = 2^(N+1) - 2, which requires at most N + 1 bits to represent without overflow.

Step-by-step Derivation:
Step 1: Maximum value of an N-bit unsigned binary number is 2^N - 1.
Step 2: Sum of two such numbers = (2^N - 1) + (2^N - 1) = 2^(N+1) - 2.
Step 3: To represent this number, ceil(log2(2^(N+1) - 1)) = N + 1 bits are required.