CSC 221: Computer Programming I
Test 2 Review


Thu, Apr 8
  • The test will include extra points (Mistakes Happen!), e.g., 52 or 53 points, but graded on a scale of 50.
Types of questions
  • factual knowledge: TRUE/FALSE, multiple choice
    TRUE or FALSE? Adding the keyword final to a field declaration ensures that the field's value cannot be changed once it is assigned.
  • conceptual understanding: short answer, discussion
    What does it mean when we say that two classes are loosely coupled? How does loose coupling tend to lead to software projects that are easier to develop and maintain? Explain your answers.
  • synthesis and application: explain/debug code, trace/modify code
    What would be output by the following while loop if x = 9 and y = 30?
         while (x < y) {
           System.out.println(x + "," + y);
           x += 4;
           y -= 5;
         }
         
Study advice
  • review online lecture notes (if not mentioned in class, won't be on test)
  • review text
  • look over quizzes, homework assignments
  • reference other sources for examples, different perspectives
Course Material
TEST 1 MATERIAL
	
Interaction and design
  modular design
      constant fields (final & static)
      shared fields (static)
  complex expresions
      logical operators (&&, ||, !), remainder operator (%)
  variable scope
      nesting conditionals, cascading if-else
      variables local to if/while block
      
Repetition and simulation
  while loops 
      controlled by boolean expression, condition-driven
      danger: infinite (black-hole) loops
  for loops
      used for counter-driven applications
      equivalent to while loops
  simulations: dice, volleyball, Pig

Design and text processing
  object-oriented design principles
      highly cohesive: each class/method maps to a single entity/behavior
      loosely coupled: classes are largely independent, interact via methods
  strings
      objects vs. primitives, strings as objects
      comparison using equals and compareTo
      methods: length, charAt, substring, indexOf, toUpperCase, toLowerCase
      Character static methods: isUpperCase, isLowerCase, isLetter, ...
      StringUtils static methods
          reverse, stripNonLetters, isPalindrome, findVowel, pigLatin, ...