This is the transcript of the mock interview with Candidate DJ (2y)

SDE Guru: Hello, Welcome to the IM interview. Thank you for taking the time to talk to me. Are you ready? Do you have a pen and paper handy, we will go through a few coding excercises?
Candidate DJ: Thank you. Yes, am ready.

SDE Guru: Before we get started can you briefly describe your background and experience?
Candidate DJ: Sure. Am a masters student in Computer Science Department here at Blah Blah University. Before joining my masters, I was working as a Software Engineer at SPM software labs for about 2 years. Currently, I also work part time as a Web Developer in the university.

SDE Guru: I see.. What technologies do you use as a Web Developer.
Candidate DJ: ASP.NET, C#, java scripting. The database that we use is MySQL

SDE Guru: What is your favorite programming language?
Candidate DJ: Am most comfortable with java. But I have coding experience in other languages as well like python,c etc.

SDE Guru: Good, which language do you want for coding excercises for this interview?
Candidate DJ: I will use Java.

SDE Guru: Great! Can you rate yourself in Java on a scale of 1 to 10, 1=worst, 10=best ?
Candidate DJ: I would rate myself as 7

SDE Guru: Why do you say you are a 7? And what will it take to get you from 7 to 8?
Candidate DJ: I have been working mostly on core Java only. I think I should learn J2EE and also learn more web application frameworks like springs, struts, hibernate etc.
SDE Guru: Shall we try a coding question?
SDE Guru: Given write a method numberToLetters(int n), where n is between 0 and 999. Can you print the number in words? so if input is 157 the output will be one hundred fifty seven.
Candidate DJ: Let me explain the algorithm first. In one String array, I will store “ten”,”twenty”,”thirty” and so on.
Candidate DJ: In another string array I will store “one”,two”,”three” and so on
Candidate DJ: From n, get the hundred place, get the corresponding string, append that string and “hundred” to output string. If hundred place is empty do nothing. do the same for tens place and then for the units place I would also need “eleven”,”twelve” and so on in another array.
SDE Guru: alright, now lets code it up and put it on ideone
Candidate DJ: Can I assume that input will be valid?
SDE Guru: Yes, the range is specified as 0 to 999, inclusive.

Candidate DJ: Here is my first attempt.

SDE Guru: Did you test it?
Candidate DJ: Yes, I tested for some cases. yet to test for some more.

SDE Guru: For an input of 123 the output is one hunderd thirty three that seems wrong
Candidate DJ: Yes, I should have made that n1-2 in tens condition
Candidate DJ:

SDE Guru: What about input of 1? that would result in an index out of bounds.
Candidate DJ: I should have made tens checking as else if ( n >10) and before dividing it by ten, i should check if its greater than 10

Candidate DJ: I updated that,

SDE Guru: Now try input 20, the output is twenty three
Candidate DJ: Oh yes, I missed that condition, here is the code

SDE Guru: Lets try input 21, output is “twenty three”
Candidate DJ: ah, the n for the units place should have been n%10, i had it has n/10. Here is the fixed code.

SDE Guru: What is the output for 100? I see “one hundred” not “one hundred”.

Candidate DJ: yes, I should have added the space before appending. should not append space at the end. I should appended space whenever am adding something to the string

SDE Guru: but 1 is “one”
Candidate DJ: I could check if the output is empty, then add it without space, else add with space

SDE Guru: what about 10? It will be “ten” and 110 is one hundredten and not “one hundred ten”
Candidate DJ: for ten alone, i missed the condition checking

SDE Guru: good.. any feedback on this interview?

Candidate DJ: I think i did not do well, it took 7-8 tries. Yes, I should have got it much earlier, kind of panicked when it didn’t work. When I saw the question, I thought I should be able to code in 10 -15 min max, never thought that it will take 1.5 hours with me making so many mistakes.