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

Answer key

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

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