it seems to me that this is a better way to evaluate students' programming skills than a paper-based quiz/exam, given that in the real world, people write code on a computer, not on paper.
If you want your exams to better approximate the real world, then speaking as an IT professional, let me make a few comments.
The Real World
- In the real world programmers have access to documentation.
Not only do they have access to documentation, they are expected to use it and refer to it regularly, if not constantly. It is a red flag to any good technical manager to have a programmer waste time trying to "figure something out" by trial and error rather than consulting the documentation or other online information.
(Of course, it is also a red flag if the programmer can't write a simple "for" loop without consulting the documentation.)
Yes, it is an advantage to know your language so well that you can use all the standard library features without consulting any references or examples. But few programmers are that good—and the ones who are, got that way by practice (experience), not by reading textbooks or doing classroom assignments.
- Writing the actual code is a very small part of designing a solution.
Design questions are important in the real world. Vast books have been written on the subject. It's not enough that your code works. It must be sufficiently robust for the conditions it will actually run in; it must be maintainable; it must be possible to modify it to accommodate new requirements without throwing the entire codebase away and starting from scratch.
Design also includes understanding the requirements and can even include querying them (proposing alterations) or surveying the source of the requirements to be sure they are really, truly understood before a solution is implemented. A classroom setting almost never simulates this accurately. In class, you are given a precise assignment, and you must solve exactly the use case precisely (even rigorously) stated. The real world isn't like that.
A standardized exam to be taken during class should probably not focus on practical programming. Take-home extended assignments would be a much better gauge of ability to write code, as abase states in his answer.