Karthic & Karthik interview question

Plc program for some examples