# Staff hardware engineer Interview Questions

# 31

Staff Hardware Engineer interview questions shared by candidates### If you have a 600 digit number with only 0's and 1's, and exactly 300 1's, can the number be a square?

6 Answers↳

The answer should be YES: @gustion: your example with 49 (7 pwr2) is correct but with 25 (5 pwr2) is incorrect. 7 in binary is 111 (3 1-bits is half of 6 bits), but 5 in binary is 101 (2 1-bits does not equal half of 6 bits). In general, any binary number with n-bits, half of which are 0's and half are 1's is a square of a binary number with half the number of bits, all being 1-value bits. In addition, the number's magnitude will be n/2-1 1-bits followed by n/2 0-bits followed by the last 1-bit. For example, lets say we have a 16-bit number. The number which will have 8 1-bit and 8 0-bit binary digits and also be a square is: 1111 1110 0000 0001 (7 1-bits followed by 8 0-bits followed by 1-bit) and this number is a square of 1111 1111 Binary number with 600 bits and 300 1-bits will have a magnitude of 299 1-bits followed by 300 0-bits followed by 1-bit, and it will be a square of a 300-bit number with the magnitude of 300 1-bits. Less

↳

Well on a simple note, 9's binary is 1001, a 4 digit binary with two 1's and two 0's, and is a perfect square. The same analogy should also be true for any such number. Less

↳

No

### What comes to mind when you think of Qualcomm first?

1 Answers↳

Thought but not stated law suit loss to Broadcom.