ISRO | ISRO CS 2015 | Question 9
The number of 1’s in the binary representation of (3*4096 + 15*256 + 5*16 + 3) are:
(A) 8
(B) 9
(C) 10
(D) 12
Answer: (C)
Explanation:
Given expression = 3*4096 + 15*256 + 5*16 + 3 = (2 + 1)*4096 + (8 + 4 + 2 + 1)*256 + (4 + 1)*16 + 2 + 1 = (2 + 1)*212 + (23 + 22 + 2 + 1 )*28 + (22 + 1)*24 + 2 + 1 = (213 + 212) + (211 + 210 + 29 + 28) + (26 + 24) + 2 + 1 As 213 is 1 followed by 12 zeros, 212 is 1 followed by 11 zeros and so on, adding all these numbers give total 10 one's
So, option (C) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.