edited by
8,144 views
25 votes
25 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 ______
edited by

5 Answers

Best answer
46 votes
46 votes
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
51 votes
51 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 6 contains two 1's.

edited by
6 votes
6 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
0 votes
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
Answer:

Related questions

37 votes
37 votes
1 answer
1
Kathleen asked Sep 12, 2014
4,782 views
When two $4$-bit numbers $A = a_3a_2a_1a_0$ and $B=b_3b_2b_1b_0$ are multiplied, the bit $c_1$ of the product $C$ is given by ________
32 votes
32 votes
8 answers
2
Kathleen asked Sep 12, 2014
10,073 views
Consider the following recursive definition of $fib$:fib(n) := if n = 0 then 1 else if n = 1 then 1 else fib(n-1) + fib(n-2)The number of times $fib$ is called (includin...
44 votes
44 votes
2 answers
3
Kathleen asked Sep 12, 2014
13,570 views
The weighted external path length of the binary tree in figure is ______
50 votes
50 votes
3 answers
4
Kathleen asked Sep 12, 2014
8,648 views
The minimum number of comparisons required to sort $5$ elements is ______