Program understanding is an important part of the domain expertise required for programming language tutoring systems. However, the understanding of student programs by a computer is extremely difficult because of the tremendous scope of variability in student solutions for nontrivial tasks. This article aims to handle such variability and improve understanding performance by a hybrid approach based on two complementary methods of graph parsing and expectation-driven analysis. The graph parsing method by Wills is utilized to recognize the programming plans in the code. At the same time, a new expectation-driven analysis is devised to generate expectations about the program design using such knowledge as the programming goals, plans, and information about the problem task. The analysis guides the plan recognition process through confirming, amending, or rejecting the expectations by checking them against the given code. Expectation-driven analysis can recognize the function and implementation level variations and errors. Unknown goal-implementing plans ale also detected. These advantages are demonstrated in an experiment of a set of student programs.