We collected 50,000 Q\&A pages containing Java code examples, accumulated over a 4 year span. Our data set is available at stackoverflow-corpus.
We sorted this data set into 3 size categories: short (~50 LOC), medium (~135 LOC), and long (~200 LOC). Then, we randomly selected the examples from each size category.
The answers to the open ended program comprehension questions are available at program-comprehension-answers.