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

Answer key

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

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