You take the test and do your best. They're not testing how good your code looks, but to see how much effort you're will to make to solve a problem on the spot OR to see if you are someone who will look at the screen dumbfounded and will simply give up.
Being a programmer isn't about knowing a specific language, it's about having the ability to solve problems.