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

Answer key

  1. True
  2. a draft you are typing
  3. data saved on the phone
  4. photos on two devices
  5. Aman
  6. a list
  7. Monsoon
  8. 4
  9. True
  10. 8
  11. True
  12. True
  13. on the phone
  14. 5
  15. the sound on/off setting
  16. your last game level
  17. Maths
  18. True
  19. 3
  20. True
  21. Stars
  22. the phone is lost
  23. in the cloud
  24. in the cloud
  25. 7
  26. 9
  27. False
  28. 2
  29. 3
  30. Kabir
  31. 2
  32. 5
  33. 3
  34. Riya
  35. Kabir
  36. 6
  37. 8
  38. False
  39. False
  40. Science

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