CS 2110 Midterm: CS 2110 Cornell 2012 Fall Examsp1sol Fall 09
Document Summary
There are 9 questions on 9 numbered pages. Check now that you have all the pages. Use the back of the pages for workspace. The exam is closed book and closed notes. Grader kpb: (8 points) tell us what the following two java programs will print. class a { A a = new a(); b b = new b(); a ab = new b(); System. out. format("%d %d %d %d %d %d", a. x, b. x, ab. x, a. y, b. y, ab. y); int x = 2; int y = 100; A() { this(3); } class b extends a { int y = 200; B() { super(4); } (4 pts) output of a. main(): 3 4 4 100 200 100 class d { public static void main(string[] args) { D d = new d(); e e = new e(); 5 : 6; } class e extends d { int m() { return 100 + super. m(); } (4 pts) output of d. main():