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

Answer key

  1. False
  2. True
  3. a list
  4. a class leaderboard
  5. on the phone
  6. 6
  7. 5
  8. Zoya
  9. on the phone
  10. Sunrise
  11. in the cloud
  12. 6
  13. the sound on/off setting
  14. 4
  15. 5
  16. photos on two devices
  17. 5
  18. in the cloud
  19. True
  20. Sports
  21. use it on any device
  22. 5
  23. Art
  24. 4
  25. True
  26. on the phone
  27. in the cloud
  28. Sports
  29. 3
  30. 5
  31. 7
  32. data saved on the phone
  33. the phone is lost
  34. 0
  35. 13
  36. Sunrise
  37. 7
  38. Kites
  39. 5
  40. 4

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