in Digital Logic edited by
3,977 views
18 votes
Consider the number given by the decimal expression:
$$16^3*9 + 16^2*7 + 16*5+3$$
The number of $1’s$ in the unsigned binary representation of the number is ______
in Digital Logic edited by
4k views

1 comment

$16^3=2^{12}$ and multiplying a number in binary with $2^x$ means that we are shifting that number to the left by $x$ bits.

So, the number $16^3 . 9$ will be $1001(=9)$ shifted by $12$ bits to the left which will become $1001000000000000$.

Same we can do with other numbers as well and will find that there is no overlapping $1's$. So total $1's = 1's$ in $9,7,16,3$.

So the answer is $9$.

Result is $1001011101010011$.
2

Subscribe to GO Classes for GATE CSE 2022

5 Answers

40 votes
 
Best answer
The hex representation of given no. is $(9753)_{16}$

Its binary representation is $(1001 0111 0101 0011)_2$

The no. of $1's$ is $9.$
edited by
31 votes

$16^3∗9+16^2∗7+16∗5+3$
In Binary representation, each number which can be represented in the power of 2 contains only one 1. 
For example 4 = 100, 32 = 100000
$16^3∗9+16^2∗7+16∗5+3$
Convert the given expression in powers of 2.
$16^3∗9+16^2∗7+16∗5+3$
$2^{12}∗(8+1)+2^8∗(4+2+1)+2^4∗(4+1)+(2+1)$
$2^{15}+2^{12}+2^{10}+2^9+2^8+2^6+2^4+2^1+ 2^0$

There are total 9 terms, hence, there will be nine 1's. for example 4+2 = 6 and 4 contains two 1's.

2 Comments

this should be the best solution
0
Yes, its best solution.
0
5 votes
We can solve this also in a different way.
See 2, 4 8, 16..... can be written as
010000...(x times 0 depend upon the number)
i.e
2 = 010
4 = 0100
8 = 01000
16=010000 and so on.
So now if any number Y multiply with any of the above the answer will be Y followed by x times 0.
i.e.
if any number say 7 is multiplied with 16 answer will be
1110000.
So number of 1 will be the number of 1 in that number as multiplication with 2, 4 8 ,6.... can only increase 0 on it.

So  number of 1 in
16^3∗9+16^2∗7+16∗5+3
is equal to
number of 1 in 9+
number of 1 in 7+
number of 1 in 5+
number of 1 in 3
=2+3+2+2
=9

1 comment

Nice analysis..
0
0 votes
We can solve this also in a different way.
See 2, 4 8, 16..... can be written as
010000...(x times 0 depend upon the number)
i.e
2 = 010
4 = 0100
8 = 01000
16=010000 and so on.
So now if any number Y multiply with any of the above the answer will be Y followed by x times 0.
i.e.
if any number say 7 is multiplied with 16 answer will be
1110000.
So number of 1 will be the number of 1 in that number as multiplication with 2, 4 8 ,6.... can only increase 0 on it.

So  number of 1
is equal to
number of 1 in 9+
number of 1 in 7+
number of 1 in 5+
number of 1 in 3
=2+3+2+2
=9
0 votes

Convert this number into hexadecimal first, So to do this I will divide the given number by 16 

$16^{3}*9+16^{2}*7+16*5+3$ 

as we can see that 16 is a common term in all except the last term, so on dividing by 16 we get 3 as remainder so next time the expression would be $16^{2}*9+16*7+5$ again upon division by 16 we would get 5 as remainder. Similarly, we would keep dividing and we would get 7 and 9 as the remainder respectively.

So the number in hexadecimal would be 9753 and we would just convert it into binary we get $(1001 0111 0101 0011)_{2}$

Hence 9 1's are there.

Answer: