Robert Bosch interview on 25th may 2006
The interview was for people with 2 years of experience, but I with 1 year of experience, took a chance. I was instructed at the beginning of the interview that “Look, though you do not have 2 years of experience, yet I thought I shall spend some time with you”. I said “My pleasure”. Then he went ahead with the interview.
He asked me “What are macros?”
I said Macros are simply replacement texts.
#define clrscr() 500
Now wherever in the program, “clrscr()” appears, it will be replaced by 500.
Then I continued writing a program.
#define clrscr() 500
I said this will print 500 on screen.
He said “Where are Macros used?”
I said they can be used to replace some magic numbers in the code. We may #define all magic numbers into some sensible macors.
He said “Where else?”
I said instead of simple one line functions. It will omit the overhead attached with the funtions while parallely giving the look and feel of functions.
“OK How much programming have you done?”
I said 30,000 lines of code.
“He said OH MY GOODNESS”
I said that was test code plus the actual code.
“So then what was it all about”
I said it was all about pointers and structures. Pointers is my favourite topic.
“Where do you rate yourself in C on a scale of 10?”
9 out of 10.
I browse net specifically for “C riddles C puzzles and C questions” and after finding them, I also share them with my batchmates. So I have been doing that for quite some time. So that way I feel very confident.
“OK What do you understand from static keyword?”
It is used to tell the compiler to preserve the value of a variable between successive calls to a function. You may contrast it with volatile keyword which tells the compiler that its value is going to change and not to optimise it.
“Tell me a situation where pointers come in handy and that situation cannot be handled otherwise?”
“Write a function with and without using pointers to swap two numbers?”
Yeah that is the answer to your earlier question..
I worte the two functions.
Then on paper he wrote two statements.
char *p = (char *) malloc(10 * sizeof(char));
He asked,”Tell me the difference between the two?”
I said in first case you are allocating memory dynamically. So you can free it when you are done with it. In second case it is meing allocated statically. So freeing it is not under your control. Both have got their own pros and cons. Using pointers makes your program tough to debug and using static memory allocation means you cannot free memory when you want to.
That was all he asked.
After that was the HR interview. He asked me all about my studies, my future plans to study, my native, Expected salary, and what not.
I am still waiting for offer letter.