Pergunta de entrevista da empresa IBM

Pretty simple coding questions. I think I was able to choose my language, and chose JavaScript. There are also some questions about why you coded the answers the way you did.