Cognizant interview question

How events loops are working