Ferozeh dot Com



Expert advice on tech interviews !

about ferozeh


Ferozeh !

Read Solved Interview Questions !

Phone Interview

My phone interview with nVidia was possibly the worst interview I had every given. The guy interviewing me was Vladimir Troy. You can access his LinkedIn profile here.

He asked me a couple of question on C/C++ about some keywords. One question I vaguely remember was

  • What does the keyword volatile in C do ?

I am not good at keywords and syntax i.e. I never learn it by heart. If need be I would probably look it up on the internet or in a book and I badly bombed my phone interview.

Next I received an email from the guy asking me to complete a programming exercise and submit in two day's time. I am pasting the exact exercise below but remember the obvious solution to it is the wrong one.

"Please read the email in its entirety and follow the instructions since not following the instructions may disqualify you from further consideration.

To get a sense of your programming abilities please implement the following two C functions within the next two days.

void * aligned_malloc(size_t bytes, size_t alignment);

void aligned_free(void * p);


aligned_malloc and aligned_free functions may only use the C runtime functions malloc and free in their implementation and cannot use any static memory. aligned_malloc takes the size of the buffer you would like to allocate and also alignment which is a power of two that will force the starting address of the buffer you return to the user to start on an alignment boundary. For example, I may request 1000 bytes starting on a 128 byte boundary by calling aligned_malloc(1000, 128). aligned_free frees the buffer returned from aligned_malloc.



Please make sure to implement the code _independently_ and not refer to the implementations available on the web. Along with your answer, please state how long it took you to implement the solution and certify that the code was implemented independently.

My policy is not to respond to emails from candidates so please work with NVIDIA's staffing team if you have any questions. The only exception is please send your answer directly back to me. If you would like to send your answer in a *.zip file please change the file extension to *.zi_ because our email system strips out all zip files. Other compressed formats are also acceptable. Regards, Vladimir Troy Senior Director, Software Operations"

You can easily find the implementation for these functions online but I don't recommend doing that.