Capgemini Engineering interview question

Bits and string manipulation based questions and asked to write a code for that.