After a few interviews this month I wanted to share a few nice exercises that would come up in technical interviews, and how I originally approached them.

Asynchronous for-loop

This exercise is related to how asynchronous programming work. If you asked me, I would rather ask about how the event loop works instead of asking this particular question.

You are given the following code:

and you’re asked two questions

  1. what’s the output?
  2. what would you add to print the numbers from 0 to 9

I will leave the first answer as an exercise for the reader but question n°2 should already…


Photo by rawpixel on Unsplash

A few years ago I started working with Node. During that time I had the opportunity to work in different companies, different teams and very different scenarios: from Enterprise solutions to middle-size companies to a very wide spectrum of startups. In most of those teams I’ve found, small and big, improvements that repeated over time from one company to another. I’ve tried to shrunk them into a list of arbitrary length because I thought it could be useful to someone.

Disclaimer: each of these problems could have multiple solutions.

1. Not shutting down gracefully

This is first on the list because it’s a fairly straightforward…


Photo by João Silas on Unsplash

A colleague asked me to check on a test suite that had a test failing but the process was still exiting with code 0. The suite was using mocha and it was connecting to a RabbitMQ queue as initialization but the catch was, the module that was opening the connection to the queue was not exposing a method for closing the connection on teardown.

I then realized the process should not be exiting at all, since a connection was still open. In the teardown section of the test suite I found something similar to this:

*Insert your favorite facepalm…


Durante una caminata espacial en el 2013, el astronauta italiano Luca Parmitano se encontró a sí mismo en grave peligro — se estaba filtrando agua en su casco.

El agua rápidamente migró en cero-G a sus ojos, orejas y nariz. Pronto Luca estaba luchando por ver y escuchar y empezó a tener dificultad para respirar.
Afortunadamente, su compañero de la caminata espacial, Chris Cassidy, estaba cerca y guió a Luca a la escotilla y a salvo.

El espacio es lo suficientemente difícil para sobrevivir sin cascos llenos de agua, por lo que la NASA pausó todas sus caminatas espaciales que…

Alejandro Oviedo

Developer, infosec aficionado, mentor and vegetarian.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store