← 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 91 · 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.💾 Where should the app save the sound on/off setting: on the phone or in the cloud? (a) in the cloud (b) on the phone
  2. 2.Which of these fits saving in the cloud? (a) notes to read offline (b) a draft you are typing (c) the sound on/off setting (d) a class leaderboard
  3. 3.Which of these fits saving on the phone? (a) a class leaderboard (b) chat messages to friends (c) photos on two devices (d) notes to read offline
  4. 4.💾 pop() takes off the last item. What does this code show?
    let songs = ["Sunrise", "Rain", "Monsoon", "Stars", "Kites"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Rain (b) Monsoon (c) Sunrise (d) Stars
  5. 5.💾 Which works with no internet at all? (a) a shared chat (b) data saved on the phone (c) a cloud backup (d) a cloud leaderboard
  6. 6.💾 Where should the app save your last game level: on the phone or in the cloud? (a) on the phone (b) in the cloud
  7. 7.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) in the cloud (b) on the phone
  8. 8.💾 What does this code show? (Positions start at 0.)
    let songs = ["Stars", "Rain", "Kites", "Sunrise"];
    show(songs[3]);
    (a) Kites (b) Stars (c) Sunrise (d) Rain
  9. 9.True or false: chat messages to friends fits saving in the cloud. (a) False (b) True
  10. 10.True or false: notes to read offline fits saving in the cloud. (a) True (b) False
  11. 11.💾 Where should the app save chat messages to friends: on the phone or in the cloud? (a) in the cloud (b) on the phone
  12. 12.True or false: the sound on/off setting fits saving on the phone. (a) True (b) False
  13. 13.💾 pop() takes off the last item. What does this code show?
    let friends = ["Kabir", "Riya", "Arjun", "Aman"];
    friends.pop();
    show(friends[friends.length - 1]);
    (a) Kabir (b) Riya (c) Aman (d) Arjun
  14. 14.True or false: a shared to-do list fits saving in the cloud. (a) True (b) False
  15. 15.Which of these fits saving in the cloud? (a) the sound on/off setting (b) a draft you are typing (c) your last game level (d) photos on two devices
  16. 16.💾 Where should the app save photos on two devices: on the phone or in the cloud? (a) on the phone (b) in the cloud
  17. 17.Which of these fits saving on the phone? (a) your last game level (b) a class leaderboard (c) photos on two devices (d) a shared to-do list
  18. 18.True or false: a draft you are typing fits saving in the cloud. (a) True (b) False
  19. 19.💾 Where should the app save a draft you are typing: on the phone or in the cloud? (a) on the phone (b) in the cloud
  20. 20.💾 What does this code show? (Positions start at 0.)
    let notes = ["Hindi", "Maths", "Science"];
    show(notes[2]);
    (a) Maths (b) Hindi (c) Science
  21. 21.True or false: a class leaderboard fits saving on the phone. (a) False (b) True
  22. 22.💾 What number does this code show?
    let songs = ["Monsoon", "Rain"];
    songs.push("Sunrise");
    songs.push("Stars");
    show(songs.length);
  23. 23.💾 What number does this code show?
    let songs = ["Kites", "Sunrise", "Stars"];
    songs.push("Monsoon");
    show(songs.length);
  24. 24.💾 pop() takes off the last item. What does this code show?
    let notes = ["Maths", "Hindi", "Sports", "Music"];
    notes.pop();
    show(notes[notes.length - 1]);
    (a) Music (b) Sports (c) Hindi (d) Maths
  25. 25.💾 Which can hold many values in order? (a) a switch (b) a single number (c) a button (d) a list
  26. 26.True or false: the sound on/off setting fits saving in the cloud. (a) True (b) False
  27. 27.💾 Where should the app save a class leaderboard: on the phone or in the cloud? (a) in the cloud (b) on the phone
  28. 28.💾 What number does this code show?
    let stars = 6;
    stars = stars - 4;
    stars = stars + 1;
    show(stars);
  29. 29.💾 What number does this code show?
    let friends = ["Meera", "Zoya", "Aman"];
    friends.push("Arjun");
    friends.push("Kabir");
    show(friends.length);
  30. 30.💾 What number does this code show?
    let points = 4;
    points = points - 4;
    points = points + 5;
    show(points);
  31. 31.💾 pop() takes off the last item. What does this code show?
    let songs = ["Kites", "Sunrise", "Ocean"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Kites (b) Sunrise (c) Ocean
  32. 32.💾 What does this code show? (Positions start at 0.)
    let notes = ["Music", "Maths", "Hindi"];
    show(notes[0]);
    (a) Music (b) Hindi (c) Maths
  33. 33.True or false: notes to read offline fits saving on the phone. (a) True (b) False
  34. 34.True or false: photos on two devices fits saving on the phone. (a) True (b) False
  35. 35.💾 What does this code show? (Positions start at 0.)
    let songs = ["Sunrise", "Kites", "Monsoon"];
    show(songs[0]);
    (a) Monsoon (b) Kites (c) Sunrise
  36. 36.💾 pop() takes off the last item. What does this code show?
    let songs = ["Monsoon", "Sunrise", "Rain", "Ocean"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Monsoon (b) Rain (c) Sunrise (d) Ocean
  37. 37.💾 What does this code show? (Positions start at 0.)
    let songs = ["Rain", "Ocean", "Monsoon", "Kites"];
    show(songs[1]);
    (a) Kites (b) Rain (c) Ocean (d) Monsoon
  38. 38.💾 pop() takes off the last item. What does this code show?
    let songs = ["Rain", "Monsoon", "Sunrise", "Stars"];
    songs.pop();
    show(songs[songs.length - 1]);
    (a) Stars (b) Monsoon (c) Rain (d) Sunrise
  39. 39.💾 What does this code show? (Positions start at 0.)
    let friends = ["Aman", "Zoya", "Arjun"];
    show(friends[2]);
    (a) Aman (b) Arjun (c) Zoya
  40. 40.💾 Where should the app save a shared to-do list: on the phone or in the cloud? (a) on the phone (b) in the cloud

Answer key

  1. on the phone
  2. a class leaderboard
  3. notes to read offline
  4. Stars
  5. data saved on the phone
  6. on the phone
  7. on the phone
  8. Sunrise
  9. True
  10. False
  11. in the cloud
  12. True
  13. Arjun
  14. True
  15. photos on two devices
  16. in the cloud
  17. your last game level
  18. False
  19. on the phone
  20. Science
  21. False
  22. 4
  23. 4
  24. Sports
  25. a list
  26. False
  27. in the cloud
  28. 3
  29. 5
  30. 5
  31. Sunrise
  32. Music
  33. True
  34. False
  35. Sunrise
  36. Rain
  37. Ocean
  38. Sunrise
  39. Arjun
  40. in the cloud

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