1.

In a URL, what does ? signify? What does & signify?

In a URL, the ? denotes the start of the parameters and the & separates the parameters. The URL https://maps.google.com/maps?saddr=39.7,-122.4&daddr=42.1,-73.9, for instance, has two parameters, one named "sadder" with value 39.7,-122.4, and one named "daddr" with value 42.1,-73.9

Show Answer

2.

Sketch the blocks for an app that, as the person holding the phone moves, periodically sends a text to the numbers 111-1111 and 222-2222. The texts sent should contain:

  • a. the text "Suzy's current address is:
  • b. the device's current address (street address)
  • c. a link to a google map page showing the current address

The app should send the text when it gets a new GPS reading and the phone has moved at least 30 meters. Keep in mind that you may use any text blocks necessary.

The LocationSensor.LocationChanged event handler is triggered periodically, when the app first gets a reading and as the device is moved. By setting the DistanceInterval, you can make it so that the event is triggered only after the device is moved a certain distance (30 meters in this case).

Show Answer

3.

Consider a Mole Mash game and suppose you want to keep a high score.

  1. Explain why you'd want to code the high score as persistent data.
  2. Think about how high score might work and explain where in the code (blocks) you would call TinyDB.StoreValue to store the high score persistently?
  3. Where in the code (blocks) would you call TinyDB.GetValue to bring the high score into the app?.

  1. Persistent data lives on even after the app is closed. For a game, you want the high score over time (successive games) to be saved.
  2. You want to store the high score in the database when a game ends and the new score is larger than the previous high score. The game might be over on a Clock.Timer event, when the time has ran out. So in that event you'd ask if the score is higher than the previous high score, and if so call the TinyDB.StoreValue to update the database.
  3. You could call TinyDB.GetValue to bring in the previous high score in Screen.Initialize, when the app begins. Alternatively, you could call it only right when you need it, say when you need to compare a new score with it.

Show Answer