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

Answer key

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

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