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

Answer key

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

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