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

Answer key

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

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