BPJ Quiz 01-03

  1. Write an entire main method that prints the following:

     Doc Mo said, "Good Job"
     David says \Do Your Homework\
    
  2. Make appropriate variables and initialize them:

     a <- 3
     b <- 6.28
     c <- Whitney Young
    
  3. Make a string d but do not initialize it.

  4. Make a variable ss that holds letters 3 through 8 of c, counting the letters the way a computer does. That is, "tney Y".

  5. Make the variable $v = 6.02 \times 10^{23}$.

Interesting commentary

One student did not understand that \n is a character (or string) instead of some kind of operator.

String a = "Begin";
String b = "End";
System.out.println(a \n b); // err

Many students thought that Avogadro’s number should be an integer:

int v = 6.02e23;  // nope

I had not yet mentioned the very disturbing fact that 10^23 is 29 in Java… because ^ does not mean exponentiation, it means “bitwise exclusive or”.