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

Answer key

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

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