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

Answer key

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

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