Bitwise interview question

Pseudo codes, pattern logics, SQL queries