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

Answer key

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

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