Caterpillar Interview Question

basic questions and simple logic questions