public class Office {
  String building;
  int room;
  String occupant;

  Office(String building, int room, String occupant) {
    this.building = building;
    this.room = room;
    this.occupant = occupant;
  }
}


public class Building {
  public Office office;

  public Building(Office office) {
    this.office = office;
  }
}


class VariableAliasingQuestion {

  // 1. Suppose somewhere in your program you have:
  void FX(Office forOffice, String toOccupant) {
    forOffice = new Office(forOffice.building, forOffice.room, toOccupant);
  }

  String question() {
    Office carmenOffice = new Office("CS", 176, "Carmen");
    FX(carmenOffice, "Fred");
    return carmenOffice.occupant;
  }

//

/** 1. What does question() return?

* A: "Carmen"
* B: "Fred"
* C: Something else

*/

}
public class ReferenceAssignmentAndMutationQuestion {

  // 2. Suppose somewhere in your program you have:
  void FX(Office o1, Office o2) {
    o2 = o1;
    o2.room = 63;
  }

  String question() {
    Office labOffice = new Office("CS", 130, "Tyler Smith");
    Office commonOffice = new Office("CS", 275, "everyone");
    FX(labOffice, commonOffice);
    return labOffice.room + ", " + commonOffice.room;
  }

/** 2. What does question() return?

* A: "63, 63"
* B: "63, 275"
* C: "130, 63"
* D: "130, 275"
* Something else

*/

}


public class ComposeObjectsQuestion {

  // 3. Suppose somewhere in your program you have:
  void FX (Office o1) {
    Building bill = new Building(o1);
    bill.office.room = 999;
  }

  int question() {
    Office peterOffice = new Office("CS", 37, "Peter Gibbons");
    Building cs = new Building(peterOffice);
    FX(peterOffice);
    return cs.office.room;
  }

/** 3. What does question() return?

* A: 37
* B: 999
* C: Something else

*/

}
public class PyretStyleVariableAliasingQuestion {

  // 4. Suppose somewhere in your program you have:
  void FX(Office o1) {
    Office o = o1;
    o = new Office("CS", 640, "Walter");
  }

  String question() {
    Office dillonOffice = new Office("CS", 808, "Dillon");
    FX(dillonOffice);
    return dillonOffice.occupant;
  }

/** 4. What does question() return?

 * A: "Dillon"
 * B: "Walter"
 * C: Something else

 */

}




























public class DynamicScopeQuestion {

  // 5. Suppose somewhere in your program you have:
  int f() {
    int x = 17;
    return g();
  }

  int g() {
    int y = 4;
    return x / y;
  }

  int question() {
    return f();
  }

//

/** 5. What does question() return?

* A: 0
* B: 4
* C: Something else

*/

}
public class DynamicFieldQuestion {

  int x = 0;

  // X. Suppose somewhere in your program you have:
  int f() {
    x = 17;
    return g();
  }

  int g() {
    int y = 4;
    return x / y;
  }

  int question() {
    return f();
  }

//

/** 6. What does question() return?

* A: 0
* B: 4
* C: Something else

*/

}














public class DynamicFieldQuestion2 {

  int x = 0;

  // 7. Suppose somewhere in your program you have:
  int f() {
    this.x = 17;
    return g();
  }

  int g() {
    int y = 4;
    return x / y;
  }

  int question() {
    return f();
  }

//

/** 7. What does question() return?

* A: 0
* B: 4
* C: Something else

*/

}

public class DynamicFieldQuestion3 {

  int x = 0;

  // X. Suppose somewhere in your program you have:
  int f() {
    int x = 17;
    return g();
  }

  int g() {
    int y = 4;
    return x / y;
  }

  int question() {
    return f();
  }

//

/** 8. What does question() return?

* A: 0
* B: 4
* C: Something else

*/

}
