CS 145 Lecture 20 – Midterm 2 Review
November 18, 2011 by Chris Johnson. Filed under cs145, exams, fall 2011, lectures.
Things to know
- The test is hand-written.
- You may write SOP instead of System.out.println.
- You need not import any classes.
- One page of handwritten notes is allowed.
- The front page of the exam will contain compact documentation for the Scanner, Random, and String classes.
- A strategy: on questions where you are asked to write a method, write the method signature first, not worrying about what it’s supposed to do. Just get the return type and arguments framed correctly. Then read what the method is supposed to do and implement it.
- There’s no lab on Wednesday, 11/23.
Review questions
Evaluate !(a && !b) for all possible values of booleans a and b.
show
Write a method that moves the mouse in a square.
show
Write a loop that moves the mouse in a square 10 times.
show
Write a method prepend that takes a String array argument and a prefix String and prepends the prefix onto all elements in the array.
show
Write a method called split that takes a String and a String delimiter and returns the tokens of the String delimited by the delimiter as an array.
show