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

Answer key

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

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