Caterpillar interview question

basic questions and simple logic questions