Yes, it's a common practice.
And most major online/freelancing job websites have them available.
Programmers feel sick and tired of tests, and it can even seem a bit insulting considering their experience, degrees, or certifications. Finding a job is tedious, jumping through the hoops is laborious, and having one more hoop to jump through is no doubt yet another anguish.
But from the employer's perspective, there are many reasons to test, and only a few not to:
Why an employer should test:
- Make sure the candidate is proficient
- Weed out the non-serious candidates
- Company hiring may require testing
- They don't know anything about programming and need a test to tell them if the candidate is proficient
Why an employer shouldn't test:
- It might scare/offend away the candidate
- The candidate might be so proficient they don't need the test
As other answers state, cramming is a horrible testing strategy. But it is always a great idea to work on sample tests, as you've asked about.
Here are some example interview questions that can be found on Stack Exchange sites: