Cognizant interview question

core java basics and pattern programming