Gridlogics interview question

Based on .net technology