Definitions
Fill in the blank
Code Outputs
100

The full name of the acronym JVM.

What is Java Virtual Machine?

100

private static int tagCount(XMLTree xml, String tag) {

int counter = 0;

if (_______) {

      if (xml.label().equals(tag)) {

            counter++;

      }

       for (inti = 0; i < xml.numberOfChildren(); i++)         {

          counter += tagCount(xml.child(i), tag);

        }

}

return counter;

}

What is xml.isTag()?

100

SimpleWriter out=new SimpleWriter1L();
out.print("39"+3);

What is 393?

200

Some object that uses the new keyword to create a new instance.

What is a constructor?

200

private static int sumOfDigits(NaturalNumber n) {

    int nDigits = 0;

    int sum = 0;

    if (!n.isZero()){

        nDigits = n.divideBy10();

        sum += ___________;

        n.multiplyBy10(nDigits);

}

return sum;

}

What is nDigits + sumOfDigits(n);?

200

SimpleWriter outStream = new SimpleWriter1L();
double threeQuarters= 3/4;
outStream.println(threeQuarters);

What is 0.0;

300

When two or more methods have the same name, in which methods must differ in number and/or formal parameters.

What is overloading?

300

private static void generateElements(String str, Set<Character> charSet) {

     if(________){

           for (int i = 0; i < str.length(); i++){

                char c = str.charAt(i);

                charSet.add(c);

           }

     }

}

What is !charSet.size() == 0?

300

The amount of times this loop runs.

int x = 8;
while ((x / 3) != 2) { x = x - 1; }

What is 0?

400

The objects in the program that need to do something in response to the events for a particular subject.

What is an observer?

400

/** 

  * @updates this, q 

  * _______

  * this * q = #this * #q 

*/ 

while (q.length() > 0) { 

     T x = q.dequeue(); 

     this.enqueue(x); 

}

What is @maintains?

400

The values for num1 and num2.

private static int m(int x, int y) {
y = x;
x = 0;
return y;
}

int num1 = 4, num 2 = 9;
num2 = m (num1, num2);

num1 = 4;
num2 = 4;

500

A single path of sequential code executing one step at a time.

What is a thread?

500

private static void getPriceMap(String fileName,

        Map<String, Integer> priceMap) {

        SimpleReader in  =  newSimpleReader1L(fileName);

while (______) {

    String temp = in.nextLine();

    int indexOfComma = temp.indexOf(',');

    String food = __________;

    String priceString =         temp.substring(indexOfComma + 1);

    Integer price = Integer.parseInt(priceString);

    priceMap.add(food, price);

   }

in.close(); 

}

What is !in.atEOS() & temp.substring(0, indexOfComma)?

500

The nextDouble( ) method of r, a variable of type Random, returns a double in a range of [0,1). Which of these expressions would you use to create a random number in the range of [-3,3)?

What is (r.nextDouble( ) - 0.5) * 6.0?

M
e
n
u