I was browsing through the Programmers stack exchange Q&A website yesterday and I stumbled upon a question about the fairness or unfairness of some interview questions that the candidate was asked to answer. Basically, the candidate was asked to answer questions out of his field of competence and felt cheated by the interview. In all fairness, he was a recent graduate and probably didn't have that much experience interviewing.
In his question, he mentioned that he wanted to write the company to tell them about the unfairness of the questions. Fortunately, the Programmers community responded well and told him that this was not the right thing to do, however a few people did agree with him. Since he might not be the only one feeling that way, I decided to write a few (non-technical) things that every programmer should know when applying for a programming job.
You don't have to answer all the questions
It's a common trick by interviewers to ask a question that the candidate will not be able to answer. Sometimes it's some kind of annoying "MBA" question like "Why are manhole covers round?" (here's the answer if you really want to know), but sometimes it's just a highly technical question that you are not expected to be able to answer. What the interviewers want to know is how you deal with problems that you don't have the answer for, because that's going to happen a lot in the work environment. If you get one of these questions, walk them through your thought process, tell them how you would find the information (ask a specialist, a colleague, on Stack Overflow, etc.). Sometimes they might want you to guess how many of one thing there is in a certain region (ex: how many gyms in New York). They want to know how good you are at estimating values, because you don't always have time to go find the information and a rough estimate might be sufficient. I dislike this kind of question, but you should be prepared to answer it nonetheless.
No matter what the question is, just answer to the best of your knowledge. If the question is out of your field of expertise (front-end, back-end, databases, algorithms, etc.), maybe they need someone able to work in multiple fields, or maybe they are just testing you. Just don't complain to them about it or you just lost all hope of getting that job; they'd rather hire someone that will try to find the solution than someone who will complain about the problem.
The interview goes both ways
If you're a decently skilled candidate, chances are that companies will be in competition with each other to get you. Many companies get it and offer great working conditions and plenty of incentives to try to convince you that they are the place where you want to work; those companies get the highly competent and motivated programmers. However, many others don't understand that and just want to fill positions; those companies get the unmotivated programmers who just want a salary.
So when you're in an interview, you should ask them about the working conditions: what kind of machine you'll be working with, which tools (source control, bug/task tracking, communications, etc.), is there a dress-code, will you work in a cubicle alone all-day or can you talk to your coworkers, ... They need to provide you with a good work environment so that you can do your best job. You're going to be there for half of your day, 5 days a week for a long time, you better make sure you're gonna enjoy the time spent there.
Never talk about the salary first
This one's pretty obvious, but never mention it first even if they haven't talked about it and they ask you if you have any questions for them. Use those questions to ask about the work environment or what a typical day at work will look like. Asking about the pay means one thing to them: you're in it for the money, not because you love the job. Also, when they do ask you about how much money you want, give them a range or a baseline (ex: I had X at my previous job, so I expect at least X or from my research people doing this job receive between Y and Z, so I'd expect something in that range). Let them come up with a number.
Practice makes perfect
Like most (all?) things, practicing helps you get better. If you're not confident in your interviewing skills, set up some interviews with companies that don't interest you all that much. You won't have as much pressure to get the job and it will help boost your confidence.
That's all I got for now, good luck!