InterviewLegend

Bit Tricks in C

Alex Chen45 min readUpdated 135 real interview reports

Firmware talks to hardware through registers, which are words where each bit means something. One bit can gate a clock while the next one clears an interrupt. That's why bit questions show up so much in Qualcomm rounds, and why a single-bit operation is a common warm-up, often asked as a C macro. The follow-ups then push on the edges, like a bad bit position or bit 31 on a signed int.

Every problem here uses the same move. You build a mask with shifts, then apply it with AND, OR or XOR. Once that feels routine, the rest is mostly a matter of getting the shift amounts right. The theory behind single-bit work is in Embedded C & OS Internals. Below is the code for each problem, with tests, in six languages.

QualcommPremium lesson · Coding round

The 6 Qualcomm problems are below.

  1. A Premium questionCoding · Easy · Signature problem
  2. A Premium questionCoding · Easy · Frequently asked
  3. A Premium questionCoding · Easy · Frequently asked

+ 3 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Qualcomm questions

$49 a year · all 100 companies · cancel anytime

From 135 Qualcomm reports, forum threads behind logins and write-ups in Chinese.

Had your Qualcomm interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Qualcomm interview guide

Know what Qualcomm asks before you walk in.

31 coding · 3 system design · 15 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.