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

Answer key

  1. False
  2. the phone is lost
  3. in the cloud
  4. Sunrise
  5. 4
  6. on the phone
  7. on the phone
  8. 5
  9. 4
  10. your last game level
  11. on the phone
  12. 2
  13. use it on any device
  14. chat messages to friends
  15. Music
  16. False
  17. data saved on the phone
  18. 3
  19. the sound on/off setting
  20. 9
  21. True
  22. a list
  23. 5
  24. photos on two devices
  25. False
  26. Sunrise
  27. Hindi
  28. Arjun
  29. in the cloud
  30. notes to read offline
  31. 0
  32. False
  33. Arjun
  34. Hindi
  35. Science
  36. a class leaderboard
  37. 7
  38. on the phone
  39. False
  40. 5

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