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

Answer key

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

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