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

Answer key

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

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