Assuming all numbers are in 2’s complement representation, which...
MSB of 2's compliment number has a weight of - 2^(n-1).
(Trick: (from reversing sign extension) just skip all leading 1's from MSB expect but 1, and then calculate the value as normal signed binary rep. ) so by calculating, we get the given number is -5 in decimal. and options are
a. -25
b. -28
c. -41
d. -37
Therefore it is clear that - 25 is divisible by - 5. so we can say that (a.) is correct.
View all questions of this test
Assuming all numbers are in 2’s complement representation, which...
Solution:
To check whether a number is divisible by another number, we can simply divide the number and check if the remainder is zero. However, in this case, dividing a number by 11111011 is not practical, so we need to use a different approach.
We can use the fact that a number is divisible by 11111011 if and only if it is divisible by its complement, which is 00000101. Therefore, we need to check whether the given numbers are divisible by 00000101.
To check whether a number is divisible by 00000101, we can use the following algorithm:
1. Take the number and complement it by flipping all its bits.
2. Add 1 to the complement to get the two's complement of the number.
3. Add the two's complement to the original number.
4. Check if the result is divisible by 2. If it is, then the original number is divisible by 00000101.
Let's apply this algorithm to the given numbers:
a) 11100111
Complement: 00011000
Two's complement: 00011001
Sum: 11111100
11111100 is divisible by 2, therefore 11100111 is divisible by 00000101.
b) 11100100
Complement: 00011011
Two's complement: 00011100
Sum: 11100000
11100000 is not divisible by 2, therefore 11100100 is not divisible by 00000101.
c) 11010111
Complement: 00101000
Two's complement: 00101001
Sum: 11100000
11100000 is not divisible by 2, therefore 11010111 is not divisible by 00000101.
d) 11011011
Complement: 00100100
Two's complement: 00100101
Sum: 11100000
11100000 is not divisible by 2, therefore 11011011 is not divisible by 00000101.
Therefore, the only number that is divisible by 11111011 is 11100111 (option A).
Assuming all numbers are in 2’s complement representation, which...
11100111