Bitwise Interview Question

java concepts as well as SQL concepts