Asking Clarifying Questions in Job Interviews

Asking Clarifying Questions in Job interviews has always been a recommended practice. Some of my friends were discussing their not-so-successful interview experiences and many times they mentioned that they solved the problem only to realize that

  1. Interviewer had asked some other question OR
  2. They had forgotten to clarify each and every case with the interviewer before attempting the solution etc.

I am not a guru in doing this but let us try this out.

When in an interview, before you jump to the solution, you should be absolutely sure that you and your interviewer are both thinking in the same direction. Interviewer asks you to solve a problem. If you dont’t ask clarifying questions, your interviewer will assume that you have fully understood the problem. So its always good to speak out what you are thinking and your interviewer will correct you thoughts are not aligned with his thoughts.

For example, Let us consider a simple (and famous question). I may not be able to identify all the cases (but who cares 🙂 .. after all its just another blog :)).

“You are getting a char* that represents a string. If this string represents a Palindrome, return TRUE, otherwise return FALSE”.

Now, lets us see how can we start solving it.

You don’t have TRUE and FALSE defined. Tell you interviewer that for simplicity, you are defining them as

#define TRUE 1
#define FALSE 0

Tell your interviewer that you could have considered using ENUM BOOL but you are focusing on the problem right now.

Define a prototype as

unsingned int IsPalindrome(char* str);

Also clarify that you are supposing that you will receive an 8 bit char string.

Discuss with your interviewer that you would do the following

if (NULL == str) return FALSE;

if (!(*str)) return FALSE; // Zero Length Strings

if (‘ ‘ != str[0] && !(str[1])) return TRUE; // 1 Character strings (See next point for spaces. They might be considered palindrome or not. If they are considered palindromes, then you can omit ‘ ‘ != str[0] )

Discuss with your interviewer the issue of SPACES.

If your interviewer says that you have to ignore spaces, then

Any string of length >=1 containing SPACES only will return FALSE
Strings like “bbaaa bb” will be considered palindrome and will return TRUE

If your interviewer says that you have to consider spaces, then

Any string of length >=1 containing SPACES only will return TRUE
Strings like “bbaaa bb” will not be considered palindrome and will return FALSE

Suggest your interviewer to change the prototype to

unsingned int IsPalindrome(char* str, size_t length);

So that you can avoid Buffer overruns. Your interviewer will either GUARANTEE that you will always get a NULL TERMINATED string (in order to simplify things) or your interviewer will allow to change the prototype. In latter case, you must change your logic accordingly.

Well, these were some questions that you can ask before solving a problem. After this, things are pretty much clear between you and your interviewer. You can carry on solving the problem after this.

Clarifying questions vary from problem to problem but there are always certain issues that you should clarify before you jump to the solution.

P.S. If someone reading this blog wants to add more questions regarding this problem, kindly do so in the comments section.

Advertisements

3 Responses to Asking Clarifying Questions in Job Interviews

  1. Touseef says:

    Don’t ask a question if you don’t have to. Remember that your primary goal is to solve the problem, not asking questions.

    P.S. I am not hired by Microsoft. Just telling my bad experience where I asked too many questions (some foolish in them :s ) to over exercise above advice.:)

  2. Yes, I agree with Touseef. We should be asking questions to fully understand the problem and no more. Don’t ask irrelevent questions.

  3. Nirmal says:

    Hi Buddy!
    Nice to hear that u made ur way to microsoft. Congraulations!!. Can u throw some light on the questions in the telephonic round and technical rounds. if poss.. mail me @ reach2nirmal@gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: