C Sc 227 Test 1 Review Sheet

C Sc 227 Test 1 Review Sheet

<p>C Sc 227 Test 1 Review Sheet Spring 2010</p><p>Quick Facts o Friday, 19-Feb-2010 where we have lectures: 301 BIO W o Everyone must have an aisle or two empty seats on either side of you o This Test is 16% of your final grade o Closed books, closed notes o Use pencil, not pen (please) o No electronic devices such as mp3 players. o You do not need a calculator (integer division differs in Java anyway) </p><p>Types, both primitive (int, char, double) and reference (String, Scanner, String227) o Evaluate expressions with int and double o Integer arithmetic: 5 / 2 is 2, 5 % 2 is 1 o Know these Math functions: o assertEquals(2.0, Math.sqrt(4.0), 1e-12) o assertEquals(-6, Math.max(-6, -7)) o assertEquals(2, Math.round(1.501)) o Output with print and println o Assignment compatibility rules o Boolean expressions with relational operators, !=, ==, and Boolean operators && || ! o If you cannot write &&, write AND on the test, o String methods: length, compareTo, substring, indexOf, charAt o Scanner object with a String argument at construction using hasNextInt() / nextInt() for string arguments containing integers, or hasNexDouble() / nextDouble() for string arguments containing doubles, or hasNext () / next() for string containing any text separated by whitespace (blanks, \n, or \t) o See practice test question #4, occurencesOf (and the answer to be linked) o Construct objects with constructors: new String227("initial value"); o Send messages to objects: objectReference.messageName(argumentsoptional)</p><p>Classes, Methods, Parameters, Testing o Understand method headings, parameters, flow of control when a method is called o JUnit: assertEquals, assertTrue, and assertFalse in test methods that are preceded with @Test o Add methods to classes that have private instance variables and a constructor (String227 specifically)</p><p>Control Structures o if statements, if...else, and nested if...else statements o for loops (known number of repetitions) o while loops (unknown number of repetitions) </p><p>Arrays 1D o Show output from code with an array, declare arrays, o Process array data: find high, low, average, print all elements in an array o Send messages to objects stored in an array String[0].substring(1, 6); o Swap two values as is done to rearrange two array elements </p><p>Resources o Section Leader Review session: Wednesday, 17-Feb, 6:00 - 7:30pm in 701 Gould Simspon o Code demos Page o Chapters 2-9 in Rick’s Book with Self-Checks Questions and Answers at the end of each chapter o Presentations 2-9, o The Practice test handed out Monday o Today's section that will be a test review session o Your projects and homework o Nick Paralante's JavaBat problems that are designed to help Computer Science students study for CS tests</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us