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

Answer key

  1. 4
  2. on the phone
  3. use it on any device
  4. on the phone
  5. in the cloud
  6. True
  7. chat messages to friends
  8. 4
  9. 5
  10. Aman
  11. True
  12. on the phone
  13. 4
  14. True
  15. True
  16. in the cloud
  17. the sound on/off setting
  18. 3
  19. False
  20. 5
  21. False
  22. 6
  23. 8
  24. Hindi
  25. Kites
  26. the phone is lost
  27. False
  28. Science
  29. Science
  30. 6
  31. 3
  32. data saved on the phone
  33. Stars
  34. False
  35. on the phone
  36. True
  37. Rain
  38. Rain
  39. True
  40. False

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