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

Answer key

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

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