Interview Questions: What does curl do?

It curls stuff, right?

A significant part of being a good interviewer is asking good questions. Today I’m starting off a series of posts on my favorite interview questions, along with some guidance on how I grade them. To kick this off, I’m going to start with my very favorite interview question:

What happens when you type “curl https://google.com” into a browser and hit enter?

Things I Like About This Question

Before we get into the meat and potatoes, let’s talk about why I like this question so much.

Broad Applicability

There isn’t a single level of experience this is a bad question for. From interns to senior folks, anyone should be able to come up with some level of answer to this question.

Leaves Room For Passion

The question is open-ended enough that it gives the candidate space to really show off what they know. It touches on the OS and kernel, networking, storage, and more. Candidates can really focus in on whatever part they really know well and show off their knowledge.

Conversational

This question is a great way to start a conversation. Unlike many questions, there isn’t a prescribed answer that I’m looking for. I don’t have to sit in silence waiting for the candidate to arrive at the “correct” answer.

What I’m Looking For

Broadly speaking, I’m looking for breadth and depth of knowledge. I want to see that the candidate has some understanding of the broad strokes of the entire flow, but also that they can go to some level of depth on at least one part of the flow. The level of depth and how many gaps in the flow are tolerable depends on the role.

For a junior or intern, I would expect significant gaps in their explanation of the flow. Not knowing how the shell actually executes curl or how DNS works beyond “it resolves names” is pretty normal and acceptable, for example. They typically need some guidance to mention some of the more obscure parts of the flow, like IP routing or TLS. Depth for them is fairly limited. They may be aware of something like a TCP handshake, but are unlikely to be able to explain how it works or what it does.

For a more senior candidate, I would expect them to be able to name most of the significant parts of the flow. They should be able to give a brief and general explanation of what the shell does, how DNS works, how the IP works, and so on. That doesn’t mean they will necessarily get down to a syscalls and packet headers level of detail, but they should be able to name and give a general description of each. I would expect that they can talk knowledgeably and in depth about one or two parts of that flow for 10 or 20 minutes.

The guidelines are non-specific because of the open-endedness of the question. Use your best judgement, but this should give you a rough idea of how to rank candidates.

The Solution

In the interest of your time, I’m not going to explain each part of this in depth. It would take several books to explain fully, and I would have an advanced case of carpal tunnel. This is just a high-level hit list of things candidates could/should talk about.

The Local Computer

  • Interrupt requests when user presses keys
  • Parsing the command line
  • stdin/stdout
  • Finding the binary with $PATH
  • Syscalls for opening/reading the binary
  • Linking to shared libraries
  • forking() and exec()ing the binary
  • DNS resolution, and the files it uses
  • Kernel networking (buffers, routing tables, etc)

The Network

  • DNS resolution
  • How DNS propagates records
  • How DNS caches work
  • ARP and finding layer 2 peers
  • IP routing
  • NAT
  • TCP handshakes

The Site

  • HTTP status codes
  • TLS/SSL
  • PKI infrastructure
comments powered by Disqus