CSE 116 - Fall 2006 - Banner
   CSE 116 - Fall 2006 - Introduction to Computer Science for Majors II
CSE 116 - Fall 2006 - Left Navigation CSE 116 - Fall 2006 - Lab 1 Contents

Exam 1 Sample Questions

 

Write method bodies for each of the following method headers:


public Integer findMin(Bag<Integer> numbers)

A method that returns the Integer that is the minimum from the Bag of Integers.


public Integer findMax(Bag<Integer> numbers)

A method that returns the Integer that is the maximum from the Bag of Integers.


public Double findAverage(Bag<Integer> numbers)

A method that returns the Double average of the numbers in the Bag of Integers.


public int howMany(String passage, char letter)

A method that returns how many occurences of a given letter occur in the String.


public boolean find(String[] passages, String toBeFound)

A method that returns true if the String toBeFound is inside the array of Strings passed in.


public int findMin(int[] numbers)

A method that returns the minimum value stored in the array.


public int findMax(int[] numbers)

A method that returns the maximum value stored in the array.


public double findAverage(int[] numbers)

A method that returns the average of all the values stored in the array.


public int findMode(int[] numbers)

A method that returns the mode (the most frequently occurring number) from the array.


public String insertChars(String passage, char toInsert)

A method that takes a String and a Character and returns a String that is the original String with the character inserted after each one of the original characters. For example, if "dog" and "f" were passed in, the returned value would be "dfofgf".


public void printFrequencies(String passage)

A method that prints to the console the frequencies of each of the characters represented in the String.


public void printWords(java.util.Collection<String> words, int howManyLetters)

A method that prints the words from the collection that have the number of letters specified by the parameter, howManyLetters.


Other things to know for the test:

  • File I/O
  • Console I/O
  • Exceptions
  • Using Iterators
  • Bags: Creating, inserting, removing, searching
  • Arrays: Creating, inserting, removing, searching
CSE 116 - Fall 2006 - Footer

 

 
Last modified: Tue Sep 26 07:39:06 2006