Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I was recently asked the following question in an interview : How do you debug a

ID: 653177 • Letter: I

Question

I was recently asked the following question in an interview :

How do you debug a C++ program ?

I started by explaining that programs may have syntax and semantic errors. Compiler reports the syntax errors which can be corrected. For semantic errors, various debuggers are available. I specifically talked about gdb, which is command line, and Visual Studio IDE's debugger, which has a GUI, and common commands. I also talked about debug and release version of code, how assertions should be used for debug build, how exceptions helps in automatic cleanup & putting the program in valid state, and how logging can be useful (e.g. using std::clog).

I want to know if this answer is complete or not. Also, I want to hear how other people will go about answering this question in a structured manner ?

Thanks.

Explanation / Answer

The answer to such a vague question can never be complete.

This sounds like one of those questions that was designed to be vague on purpose: I think you should have avoided excessive waffle and asked them to narrow the focus of the question. As you mentioned, you first classify errors into syntax and semantics, then you branch your answer from there - but since you already assumed they wanted you to discuss both in depth, you simply carried on talking.

Yes, what you have said is fine, but no-one here will be able to tell you if you answered the interview question.

Personally, I would approached by returning a question "why kind of C++ issue am I debugging?" (Segmentation Fault is very different to Unexpected ... as you know, but you should alwaysmake clear your assumptions in an interview) and taken it from there, once the question is narrowed enough that I would be able to answer it precisely and largely in entirety. Think of it like this: imagine they've just said to you "my car doesn't work, can you tell me why?". Would you really start trying to answer with so little information?

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote