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

Answer key

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

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