Out of interest, what do you think a programming job involves?
Creating event programs (you know, those little paper things that they hand out at graduations, funerals, and other things)?
*NOTE* I have no job experience in programming or anything computer related, so the following is not intended to be taken too seriously.
As to the OP's question, it will likely vary from job to job. You will likely need to know how to program, the language you will need to know will likely vary from task to task and employer to employer. For a fairly general idea of some of the things some employers look for, I suggest visiting the "Jobs" board on this site:
1. You should know how to reverse a linked-list.
2. Find the 10001st prime.
3. Find all the sum of all of the factors of 3 and 5 below 1000.
/sarcasm
Seriously though, interview tests have questions like this. While relatively simple, I've seen many people fail them epically and they demonstrate some fundamental problem solving skills that are essential to be a successful program.
Well... here are some bits and pieces nicked (and paraphrased) from a job ad for a graduate C++ developer.
To get this job you'd need to be able to handle the assorted responsibilies listed below
Andy
Graduate C++ Developer Wanted!
<usual introductoy spiel deleted>
[responsibilities]
- analyze requirements.
- produce functional specification and task breakdown with peer review.
- design and implement to agreed schedule.
- work as part of a development team.
- deliver major new features every 12 months
- delivery minor releases in between
- work closely with peers to manage interdependencies, issues and risks.
- be aware of the big picture, to ensure no regressions caused by new code
- avoid compromising the security and integrity of the product.
- to continuous improve product quality, performance and supportability.
[requirements]
- Computer Science degree or equivalent
- knowledge of C++
- excellent communication skills (written and verbal).
- well organised
- ability to multi-task.
- attention to detail.
It's sad to see so many employers require a CS degree (some even a masters!) to even consider a candidate. I've seen (and tutored) so many "imbeciles" that wormed their way through their degree program and still couldn't code themselves out of a paper bag after it was all over with. Any joker with a wad of cash can get a degree anymore...
Alternatively, there are quite a few non-degree-holders on this site that are on a completely higher level of competence than the aforementioned.
I think brokenbot is unfamiliar with the question...
The correct question is:
"Find the sum of all unique multiples of 3 or 5 less than N."
(Where N varies by the questioner.) This requires a little thought because, for example, 15 is both a multiple of 3 and a multiple of 5, but we cannot add 15 twice.
There is a naïve implementation involving loops...
And there is the nice mathematical implementation involving three calculations using the triangular number formula, two additions, and a subtraction.