writing code on paper is little different from writing it on a computer when you get used to it.
Maybe I'm getting old but it's how I actually learned programming. We used a mainframe and each student had a grand total of 5 minutes of computer time (CPU time that is) for the entire semester, so we'd better make darn sure that our code worked before we started to type it in.
And that's what it all comes down to, practice. There's no substitute for experience in this, and trying to find shortcuts isn't going to work very well.
As to your first point, I recognise myself in that. You're nervous, in unfamiliar surroundings, and that questionaire can determine your future. Not the best situation to give peak performance, and it usually shows in my results (job interviews are just the same).
But there too experience works. Do a lot of practice exams.
And what also works is to try and be as relaxed as you can for the exam. Don't drink alcohol or eat high-caloric food in the day or days leading up to the exam. Some people suggest yoga to help clear the mind (I've not tried this).
If your path to the exam location suffers from severe traffic jams, try taking public transport. Plan your journey to arrive at least half an hour early, gives you some peace of mind in case of delays.
Drink water before you start, and do go to the toilet as well (nothing worse than getting uncomfortable halfway through

).
As you see most of that has nothing to do with the actual content of the exam, and will work just as well on any examination (or indeed job interview), as long as you are confident that you have what it takes to pass (and yes, the last several hours before the exam you WILL feel you know nothing at all, but if you actually do know it and can calm yourself it will come back when needed).
Cramming in fact will often make it worse. There are solid scientific reasons for that.
What cramming does is pump knowledge into shortterm memory without imprinting it in longterm memory.
What that means is that the knowledge will be there "at the top of your brain" for 24-48 hours after which it will be gone again.
That's not going to do you any good if you need more than 24 hours to learn for the exam, and quite apart from that will not leave you with a level of confidence in your skill.
Of course it also doesn't actually teach you anything, so that grade (if you pass) will be worthless as it won't reflect your actual knowledge.