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

Answer key

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

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