Page 67 - AP Computer Science A, 7th edition
P. 67

}
37. Which /∗ code to swap tile at position size with tile at position index ∗ / performs the swap correctly?
(A) (B)
(C) (D)
tiles.set(size, temp); tiles.set(index, tiles.get(size));
tiles.set(index, tiles.get(size)); tiles.set(size, temp);
tiles.swap(index, size);
tiles.get(size, temp); tiles.get(index, tiles.set(size));
(E)
38. Which is true about the getNewTile algorithm?
(A)
(B)
(C)
(D)
The algorithm allows the program to keep track of both used and unused tiles.
The tiles list becomes one element shorter when getNewTile is executed.
The algorithm selects a random Tile from all tiles in the list.
The tiles list has used tiles in the beginning and unused tiles at the end.
tiles.get(index, tiles.set(size)); tiles.get(size, temp);
(E)
39. Consider the following two classes.
The tiles list contains only tiles that have not been used.
public class Bird {
public void act() {
System.out.print("fly ");










































































   65   66   67   68   69