Quiz 4 will be on Monday, November 7th. It will cover for loops for arrays and strings as well as number representations (binary, hexadecimal, octal) and unit testing. Here are some review questions:

What is the hexadecimal (base-16) number that is equivalent to the binary (base-2) number 11011100?

(See hw2 for more example questions on binary, hexadecimal, etc.)

How do you test a method that does not return anything?

Why is unit testing beneficial?

Why is writing more tests better than writing just a few?

Write a method that returns an array of 30 random integers from 0 to 50.

Write the twoBOrNotTwoB method with a for loop to that will return whether the String has exactly two 'b' characters in it.

public boolean twoBOrNotTwoB(String a) {
}

Write the sumMod4Is3 method (with a for loop) to find and return the sum of all the values x in the given array where x mod 4 is 3. (i.e. if the remainder is 3 when dividing by 4)

public int sumMod4Is3 (int[] c) {
}

Write the squareMultiplesOf5 method (with a for loop) to modify all the values in the array that are multiples of 5 by squaring them. The method must modify the given array and return the same array. (e.g. if the array is {1,3,4,5,10}, the modified array would be {1,3,4,25,100})

public int[] squareMultiplesOf5(int[] b) {
}

Write the shortestString method (with a for loop) to find and return the length of the shortest string in a given array of Strings. (e.g. if the array is {"Halloween","Java","Testing","Number"}, the method would return 4)