Disclosed is a method and system for administering to a student a problem in computer science for testing, analysis and feedback. The student is provided with an item pool of predetermined test problems to be selected by the student. The student inputs a solution in response to the problem selected, and the solution program is converted, by lexing and parsing, into an abstract syntax tree representation. Predetermined knowledge base patterns are selected from a knowledge base and compared against portions of the abstract syntax tree. Messages and a score are provided to the student which indicate the correctness or incorrectness of the solution program, as determined by the knowledge base patterns which were matched against the portions of the abstract syntax tree. The present method and system is especially qualified to analyze free-response test items.