Time for C programming !!. This section will highlight my experience with C (whatever)and of everyone around me and in the “Indian” context.
I’ve seen a concept called “Hand-running”. Now believe me this was some pathetic technique to run the C program on paper. I mean come on, people invest millions of dollars to create high end C compilers and here we are running the code on a piece paper!!!?? Seemed a pretty crappy job. Ok fine for beginners, but hello, for how long, not every program, come on!!. So the moral of the story: Time wasted in stupid hand running could have been invested in going down with the program on the computer, doing it more practically rather than too theoretically. This is the problem I will be highlighting all the way along: too much theory less practical = no-innovation & no discoveries & no product = pathetic service oriented industry.
Ok so now turning to them interview questions in C. I really don’t understand what the companies expect by giving haphazard questions. Now every question has a origin, it is the person who is ground-zero, the one who thought of the question and penned it down. Now I bet that fellow did not think out of the blue in a dream or something about the question it happened so because it was practical experience, the Q was framed after numerous trials on the computer to verify its validity. Now here the same Q is set in the placement papers and is supposed to be solved by the individual just by looking at it in them darn “What will be the output of the following program ? “ type questions. Now I do not object to such Q’s only that sometimes they are too crappy looking to be solved by hand without computer aid. And why should someone be given the task to write a program in 2 hrs without aid from whatever, when the person at ground-zero i.e the source of the Q, did in 3 or less hrs or so using full aid of Uncle Google or so.. This is a listing of a few “questions” you will most definitely come across (Ctrl + Ced):
a) What is the output of following code?
int i = 7;
printf( “%d”, i++ * i++ );
b) What would happen to the array after executing the following statements?
int a[5], i = 1;
a[i] = i++;
c) What is the value of i after the execution of the following statement?
int i = 7;
i = ++i;
Could have written more but running short of space… ;)
These idiotic questions are very often asked in Indian Programming world. The outputs are undefined. Even if such questions are asked, the right answer will be “the result is undefined”. For the above program, you may get some output. But it is wrong. You have to understand that compilers may not check ‘Undefined’ grammars...
So if you really want to get a good know-how of C, screw or get rid of Let Us C or whatever book you’ve got. The original book - The C Programming Lang. By Kernighan & Ritchie is the best. And for curious-kitties Advanced C by Peter D. Hipson is another awesome book, atleast I’ve used these for long and they rock……trust me ladies and gentlemen production C code looks more horrible than any other code u've ever seen and its written by someone else who is probably tanning on the beach in Hawaii whilst you sweat at office...
No comments:
Post a Comment