VMWare Inc Interview Question
Software Engineer / DevelopersI had a telephonic with VMware where i was grilled on three different code snippets. All three involved finding bugs and coming up with corrected code segments. One of them was in Java, one in C++ and one in C. The one in java was straight forward related to linked lists (reversal etc.). The one in C was probably the trickiest one because the bugs were rather subtle although not difficult to point out if you keep your eyes open(Some body has already mentioned the Base64 encoding question). The way i thought made it easier for me was to speak out whatever you are thinking while debugging the code. In my case, the interviewer liked the fact that i was talking through my thought process and he did not try to confuse me. Infact he was proactive in telling me when i was correct.
The whole point of this exercise is to find out whether u can read lotsa code, understand it fairly quickly and use it given what it does in the right way; because that is what developers have to do on a daily basis (especially with the legacy code).
code was emailed to me
error
: see what the actual function returns (return code) on failure and free the memory if it fails.
: check for size allocating memory malloc(func +1)
: check how u pass the double pointe **ptr to the encoding function
:check for data size for behaviour undefined function call
: return if fails to allocate the memory for encoding array
: final the ancoded string has to be manually null terminated *ptr[size] = '\0'
take this tips u don't have problem understanding the code
Could you tell me the nature of the bugs in their code snippit? Is it mainly syntax or logic? Are they hard to find?
- mimi November 04, 2006