Name: ________________________________

CSE373 Spring Quarter
University of Washington
Miniquiz #5
April 13, 2005
Closed book, closed notes, closed neighbor; no calculators
1 point per part except as noted

.
⌊2⌋ + ⌊2.25⌋ + ⌊2.75⌋ 
  1. 6
  2. a value > 6 but < 7
  3. 7
  4. 8
  5. 9
2 + 2 + 2 = 6

Aside: note the Unicode code points (character values) for the special symbols, which in HTML must be decimal values.  To display them you also need to select a Unicode font, such as Arial Unicode.

left ceiling h2308 &#8968;

right ceiling h2309 &8969;

left floor h2308 &#8970;

right floor h230b &#8971;

 
.
⌈2⌉ + ⌈2.25⌉ + ⌈2.75⌉ 
  1. 6
  2. a value > 8 but < 9
  3. 7
  4. 8
  5. 9
2 + 3 + 3 = 8
 
Study this method:
static int mystery (int input) {
     if (input > 2) {
          return 0;
     }
     return 1 + mystery(2 * input);
}

What is the value of mystery(0) ? (i.e., what value would be returned by a call to mystery(0)?)

  1. a negative value       
  2. 0
  3. 1
  4. 2
  5. 3
  6. a value >= 4
  7. no return -- an infinite recursion
Each recursive call is the same: mystery(2*0) or mystery(0), so you get infinite recursion. 
 
. (2 pts., -1 for each error up to -2)
S = {w, x, y, z}, R = {(w,w), (x,x), (y,y), (z,z)}.

Is R an equivalence relation? Circle A, or as many of B through F as apply.

  1. Yes                       
  2. No, because it is not transitive
  3. No, because it is not symmetric
  4. No, because it is not anti-symmetric
  5. No, because it is not a partial order
  6. No, because it is not a function
A

An equivalence relation, by definition, is a relation which is reflexive, symmetric, and transitive.  R has all three of these properties.  Anti-symmetry, partial order, being a function -- these properties need not be considered in answering the question.  Of course, for practice, you might want to determine which of those properties R does have.

 
. (1 pt. each)
log327 = _____    log21024 = _____    
3; 10 
 

 

With respect to Homework #2, name a class (if any) which extends JPanel: _______________
DocumentViewer, SpellerViewer 
 
. (bonus question -- 1 free pt.)
What is Martin's First Rule for proving any theorem?

 

 

"Convince yourself that what you're trying to prove is true."