IBM interview question

Two moderately easy coding questions