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

Answer key

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

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