The following diagram represents a finite state machine which takes as input a binary number from the least significant bit.

Which of the following is TRUE?
View worked solution
Answer: B
To understand the behavior of the given finite state machine, let us trace its transitions from the initial state (let's call it ) when processing a binary number from the Least Significant Bit (LSB) to the Most Significant Bit (MSB).
Standard 2's Complement Algorithm
To find the 2's complement of a binary number starting from the LSB:
- Scan the bits from right to left (LSB to MSB).
- Keep all leading s and the first unchanged.
- Invert all the remaining bits after the first (i.e., and ).
Tracing the State Machine
Let the initial state be and the second state be :
- In state (before encountering the first ):
- An input of produces an output of and keeps the machine in .
- An input of produces an output of and transitions the machine to .
- In state (after encountering the first ):
- An input of produces an output of and keeps the machine in .
- An input of produces an output of and keeps the machine in .
Example Trace
Consider the input decimal number , which is represented in binary as . Reading from LSB to MSB, the input sequence is :
- Input : Machine is in , outputs , remains in .
- Input : Machine is in , outputs , transitions to .
- Input : Machine is in , outputs , remains in .
The output sequence from LSB to MSB is , which represents the binary number (decimal ).
Since the 2's complement of () is indeed (), the machine correctly computes the 2's complement of the input binary number.
Free practice · Your answers on this page are not saved.
