Cognizant interview question

angular lifecycle hooks and component communication