Recursive Palindromosity
========================

If the first letter and last character of a string do not match, return
false. Otherwise, recurse on the substring that omits these two
characters. What is the base case?

a.  irrelevant; the recursion is invalid
b.  return true on the empty string
c.  *return true if the string is of length zero or one*
d.  return false if length one, true if length zero

Inheritance
===========

Can `GlassQueue` access the attributes `size`, `front`, `rear`, and
`queue` of its parent?

a.  yes, subclasses can always access a parent's attributes
b.  yes, but only if they are declared `public`
c.  no, only *methods* of a superclass can be accessed; this code won't
    compile
d.  *yes, if they are declared `public` or `protected`*

Two Runnables
=============

``` {.java}
public class Clicker1 {
    public static void main(String[] args) {
        Counter c = new Counter();
        Runnable r1 = new Increase(c, 10000);
        Runnable r2 = new Increase(c, -5000);
        r1.run();
        r2.run();
        System.out.println(c);}}
```

What's the output?

a.  none; an exception is thrown
b.  `"Count is: 0"`
c.  `"Count is: 5000"`
d.  *`"Count is: 10000"`* (note tricky for loop conditions)

Incremental interference
========================

What happens if *several* increments by `t1` happen between the read
step of a `t2` increment and its write step?

a.  All of the `t1` ones work, but the `t2` one doesn't.
b.  Only the last `t1` increment works.
c.  *None of the `t1` increments have any effect.*
d.  An exception is thrown.

Queue interference
==================

Suppose `q` is the array of a unsynchronized queue, and one thread tries
to enqueue `x` at about the same time as another thread tries to enqueue
`y`. The rear index is originally `r`. Which of these is not possible?

a.  `x` goes in position `q[r+1]`, y in `q[r+2]`
b.  `x` goes in position `q[r+2]`, y in `q[r+1]`
c.  position `q[r+1]` is null, `x` goes in `q[r+2]`
d.  `y` goes in `q[r+1]`, position `q[r+2]` is null
e.  *all are possible*

Making classes threadsafe
=========================

Conservatively, which methods of a class must be marked as synchronized
to make the class threadsafe?

a.  observers
b.  transformers
c.  *observers and transformers* (observers too, since they might depend upon invariants altered in transformers)
d.  all methods (pure functions (that do not depend upon invariants) need not be synchronized)