← Data: variables, lists and saving lesson New set →

App Dev Worksheet: Variables, Lists and Saving

App development lesson 15: Data: variables, lists and saving · Set 139 · 40 questions
TalentJR

Developer's tip (Box, list, place): A variable holds one value; a list holds many in order. Positions start at 0. push adds to the end; pop takes off the last item; length is how many items. On the phone: works offline, private. In the cloud: shared, any device, needs the internet.

NameDateTime takenScore ___ / 40
  1. 1.💾 In most code, the first item of a list is at position ___. (a) 0 (b) 2 (c) 10 (d) 1
  2. 2.Which of these fits saving on the phone? (a) your last game level (b) chat messages to friends (c) a shared to-do list (d) photos on two devices
  3. 3.💾 Data saved only on the phone is lost when ___. (a) you send a message (b) the phone is lost (c) the app is closed (d) the screen turns off
  4. 4.Which of these fits saving on the phone? (a) a class leaderboard (b) a draft you are typing (c) a shared to-do list (d) photos on two devices
  5. 5.💾 What number does this code show?
    let score = 5;
    score = score - 2;
    score = score + 1;
    show(score);
  6. 6.💾 What number does this code show?
    let coins = 7;
    coins = coins - 3;
    coins = coins + 2;
    show(coins);
  7. 7.💾 What number does this code show?
    let points = 4;
    points = points - 1;
    points = points + 2;
    show(points);
  8. 8.True or false: a class leaderboard fits saving on the phone. (a) False (b) True
  9. 9.True or false: your last game level fits saving in the cloud. (a) True (b) False
  10. 10.💾 Where should the app save a shared to-do list: on the phone or in the cloud? (a) in the cloud (b) on the phone
  11. 11.💾 pop() takes off the last item. What does this code show?
    let notes = ["Art", "Science", "Music"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Art (b) Music (c) Science
  12. 12.💾 Saving data in the cloud lets you ___. (a) skip the internet (b) use it on any device (c) never need a password (d) shrink the app
  13. 13.💾 What number does this code show?
    let lives = 7;
    lives = lives - 7;
    lives = lives + 5;
    show(lives);
  14. 14.💾 Where should the app save a class leaderboard: on the phone or in the cloud? (a) on the phone (b) in the cloud
  15. 15.Which of these fits saving on the phone? (a) a class leaderboard (b) chat messages to friends (c) notes to read offline (d) photos on two devices
  16. 16.💾 What number does this code show?
    let coins = 5;
    coins = coins - 5;
    coins = coins + 4;
    show(coins);
  17. 17.💾 What does this code show? (Positions start at 0.)
    let songs = ["Sunrise", "Stars", "Monsoon", "Kites"];
    show(songs[3]);
    (a) Stars (b) Sunrise (c) Monsoon (d) Kites
  18. 18.💾 What number does this code show?
    let score = 9;
    score = score - 2;
    score = score + 2;
    show(score);
  19. 19.Which of these fits saving on the phone? (a) photos on two devices (b) the sound on/off setting (c) a class leaderboard (d) chat messages to friends
  20. 20.💾 What number does this code show?
    let friends = ["Meera", "Aman", "Arjun"];
    friends.push("Riya");
    friends.push("Kabir");
    show(friends.length);
  21. 21.💾 pop() takes off the last item. What does this code show?
    let notes = ["Art", "Science", "Sports", "Music"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Music (b) Art (c) Sports (d) Science
  22. 22.💾 Where should the app save photos on two devices: on the phone or in the cloud? (a) in the cloud (b) on the phone
  23. 23.💾 pop() takes off the last item. What does this code show?
    let notes = ["Maths", "Science", "Art", "Music", "Sports"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Art (b) Maths (c) Music (d) Science
  24. 24.True or false: a class leaderboard fits saving in the cloud. (a) True (b) False
  25. 25.💾 Which can hold many values in order? (a) a switch (b) a single number (c) a list (d) a button
  26. 26.True or false: chat messages to friends fits saving on the phone. (a) True (b) False
  27. 27.💾 pop() takes off the last item. What does this code show?
    let notes = ["Maths", "Art", "Science"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Science (b) Maths (c) Art
  28. 28.True or false: the sound on/off setting fits saving on the phone. (a) False (b) True
  29. 29.💾 pop() takes off the last item. What does this code show?
    let songs = ["Ocean", "Rain", "Stars"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Stars (b) Ocean (c) Rain
  30. 30.💾 What number does this code show?
    let lives = 6;
    lives = lives - 3;
    lives = lives + 3;
    show(lives);
  31. 31.True or false: your last game level fits saving on the phone. (a) True (b) False
  32. 32.💾 What number does this code show?
    let songs = ["Kites", "Sunrise", "Ocean", "Monsoon"];
    songs.push("Rain");
    songs.push("Stars");
    show(songs.length);
  33. 33.Which of these fits saving in the cloud? (a) chat messages to friends (b) your last game level (c) notes to read offline (d) the sound on/off setting
  34. 34.💾 pop() takes off the last item. What does this code show?
    let songs = ["Rain", "Monsoon", "Ocean", "Stars"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Rain (b) Ocean (c) Monsoon (d) Stars
  35. 35.💾 pop() takes off the last item. What does this code show?
    let songs = ["Rain", "Stars", "Monsoon"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Stars (b) Monsoon (c) Rain
  36. 36.💾 pop() takes off the last item. What does this code show?
    let songs = ["Ocean", "Kites", "Rain"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Kites (b) Ocean (c) Rain
  37. 37.💾 What number does this code show?
    let score = 7;
    score = score - 2;
    score = score + 4;
    show(score);
  38. 38.💾 pop() takes off the last item. What does this code show?
    let notes = ["Art", "Music", "Maths"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Maths (b) Art (c) Music
  39. 39.💾 pop() takes off the last item. What does this code show?
    let songs = ["Monsoon", "Rain", "Kites", "Sunrise"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Rain (b) Sunrise (c) Monsoon (d) Kites
  40. 40.True or false: notes to read offline fits saving in the cloud. (a) False (b) True

Answer key

  1. 0
  2. your last game level
  3. the phone is lost
  4. a draft you are typing
  5. 4
  6. 6
  7. 5
  8. False
  9. False
  10. in the cloud
  11. Science
  12. use it on any device
  13. 5
  14. in the cloud
  15. notes to read offline
  16. 4
  17. Kites
  18. 9
  19. the sound on/off setting
  20. 5
  21. Sports
  22. in the cloud
  23. Music
  24. True
  25. a list
  26. False
  27. Art
  28. True
  29. Rain
  30. 6
  31. True
  32. 6
  33. chat messages to friends
  34. Ocean
  35. Stars
  36. Kites
  37. 9
  38. Music
  39. Kites
  40. False

Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students