An FSM can be used to add two given numbers (integers). This remark is —

2021

An FSM can be used to add two given numbers (integers). This remark is —

Answer: A. TrueAn FSM's limit is on how many internal states it holds, not on how long an input it can process. Whenever the decision at each step depends on the input only…

  1. A.

    True

  2. B.

    False

  3. C.

    Maybe True

  4. D.

    None of the above

Attempted by 144 students.

Show answer & explanation

Correct answer: A

An FSM's limit is on how many internal states it holds, not on how long an input it can process. Whenever the decision at each step depends on the input only through a fixed, bounded summary of what came before it (never through the growing input itself), a finite-state machine can compute it, no matter how long the stream is.

  1. Feed the two binary numbers bit by bit, starting from the least significant bit (LSB) of each.

  2. Keep exactly one bit of state, the carry into the current position, so only two states are ever needed: carry = 0 and carry = 1.

  3. At each step, on input bits (a, b) with incoming carry c, output (a XOR b XOR c) and move to carry' = 1 when at least two of {a, b, c} are 1, else carry' = 0, the standard full-adder rule.

  4. After the last bit pair, output the final carry as the most significant bit of the sum.

Cross-check with 111 (7) + 001 (1), read LSB first: (1,1) with carry 0 gives output 0, carry 1; (1,0) with carry 1 gives output 0, carry 1; (1,0) with carry 1 gives output 0, carry 1. After the last pair the outgoing carry is 1, so it is emitted as the next (most significant) bit. Reading the bits from most significant to least significant gives 1000 in binary, which is 8, matching 7 + 1 = 8. This confirms the two-state construction and the final-carry flush work together for operands of any length.

So the remark is True. A common trap is confusing "an FSM cannot hold an arbitrarily large integer written out in its state" (true) with "an FSM cannot compute the sum of two such integers" (false). The machine never stores the whole number; it only ever tracks the single carry bit at each step, and that never grows with the operands' length.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Bpsc

Loading lesson…