Programming Fundamentals · Interview question

The compiler prints fifteen errors. Where should you start?

A strong answer

Always at the first error in the output. Compilers parse top to bottom and recover from errors imperfectly, one missing semicolon can throw off the parser for the rest of the file, producing dozens of cascading errors that all stem from the same original problem. Fix the first one, recompile, and many of the later errors usually disappear. The mistake newer programmers make is reading the error count and panicking, or starting at the bottom because "that's the last thing the compiler said." The first error is the most reliable signal of what's actually wrong; everything after it is the compiler's confused interpretation of code that's already broken.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

Errors & Debugging

Errors are messages from the compiler trying to help. Learn to read them, distinguish the three kinds of bugs, and build the mindset that turns debugging from frustration into a skill.

More Errors & Debugging questions

Browse all 472 interview questions
The compiler prints fifteen errors. Where should you start? | EmbeddedPrep.io