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

Answer key

  1. True
  2. True
  3. 5
  4. False
  5. notes to read offline
  6. Kabir
  7. chat messages to friends
  8. 4
  9. Maths
  10. on the phone
  11. on the phone
  12. Maths
  13. 12
  14. the sound on/off setting
  15. photos on two devices
  16. in the cloud
  17. True
  18. in the cloud
  19. the phone is lost
  20. use it on any device
  21. on the phone
  22. a class leaderboard
  23. 3
  24. False
  25. 3
  26. 4
  27. on the phone
  28. Sunrise
  29. Ocean
  30. False
  31. Rain
  32. in the cloud
  33. 6
  34. Zoya
  35. 4
  36. Stars
  37. a draft you are typing
  38. 3
  39. False
  40. 0

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