General Motors (GM) Interview Question

I had one on bit manipulation and a basic for-loop/string problem.