Intel Corporation interview question

two logic questions and one programing question.