midterm-11wi - CSE 143, Winter 2011 Midterm Exam Friday,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 143, Winter 2011 Midterm Exam Friday, February 11, 2011 Personal Information: Name: ___________________________________________ Section: ___________________ TA: ___________________ Student ID #: ___________________ You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the instructor calls for papers. This exam is open-book/notes. You may not use any computing devices including calculators. Code will be graded on proper behavior/output and not on style, unless otherwise indicated. Do not abbreviate code, such as "ditto" marks or dot-dot-dot . .. marks. The only abbreviations that are allowed for this exam are: S.o.p for System.out.print, and S.o.pln for System.out.println. You do not need to write import statements in your code. If you write your answer on scratch paper, please clearly write your name on every sheet and write a note on the original sheet directing the grader to the scratch paper. We are not responsible for lost scratch paper or for answers on scratch paper that are not seen by the grader due to poor marking. If you enter the room, you must turn in an exam before leaving the room. You must show your Student ID to a TA or instructor for your exam to be accepted. Good luck! Score summary: (for grader only) Problem Description Earned Max 1 ArrayList Mystery 20 2 Recursive Tracing 20 3 Stacks and Queues 15 4 Collections 15 5 Linked Lists 15 6 Recursive Programming 15 TOTAL Total Points 100 1 of 8
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. ArrayList Mystery Write the output produced by the following method when passed each of the following ArrayList s: public static void mystery (ArrayList<Integer> list) { for (int i = 0; i < list.size(); i++) { int n = list.get(i); if (n % 10 == 0) { list.remove(i); list.add(n); } } System.out.println(list); } List Output a) [1, 20, 3, 40] b) [80, 3, 40, 20, 7] c) [40, 20, 60, 1, 80, 30] 2. Recursive Tracing Write the output produced by the following recursive method when passed each of the following integer parameters:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

midterm-11wi - CSE 143, Winter 2011 Midterm Exam Friday,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online