Question 1: Why is it a good idea to test a general class with a driver program before trying to use it?
Question 2: What is the difference between black box and glass box debugging?
Question 3; In pseudo-code, describe CreateTest.java.
Question 4: In pseudo code, describe the driver program that is provided below.
Question 5: If x = 37, y=23, z=-110, r=-32 answer the following questions. Assume that we are working with bytes. To answer thesequestions, you will need to convert from decimal to binary. Remember that System.out.println DOES NOT print binary values. You will need to convert your results to decimal. Of course you can verify your results by computer. Remember that there will be questions like this on the quiz, so try them yourself first.
a. System.out.println(x&y);
b. System.out.println(x^y);
c. System.out.println(~x|y);
d. System.out.println(~x>>2);
e. System.out.println((byte)(z<<(~r>>4)));
f. System.out.println
((byte)(x + (x<<1) + (x<<2) + (x<<3)));
g. System.out.println(y>>>3);
h. System.out.println(x&y|z^r);
i. System.out.println(~x + x);
j. System.out.println(x|(3<<4));
Question 6: In about a sentence, give a reasonable example of when the following operators would be useful when working with strings of bits.
a. or operation (|):
b. and operation (&):
c. exclusive or operation (^):
d. left shift operation: (<<):
Question 7: Suppose we need to create a multiple-choice exam, where each question has four possible choices. Briefly describe (in a few sentences) how we could create a new class that uses inheritance that would allow this. Giving class API and a brief description of the needed methods would also suffice.
Question 8: Suppose we needed to modify the BitMap class to handle a bit stream of up to 16384 bits. Briefly describe the changes necessary to handle this refinement. Can you think of a way that the maximum number of bits to be handled is completely flexible?