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

Answer key

  1. data saved on the phone
  2. False
  3. 10
  4. a shared to-do list
  5. 4
  6. True
  7. True
  8. a list
  9. False
  10. in the cloud
  11. on the phone
  12. on the phone
  13. True
  14. notes to read offline
  15. Meera
  16. 1
  17. in the cloud
  18. Rain
  19. 5
  20. use it on any device
  21. True
  22. Sunrise
  23. 0
  24. 3
  25. 4
  26. 4
  27. Riya
  28. Ocean
  29. Science
  30. Sunrise
  31. False
  32. Kabir
  33. on the phone
  34. your last game level
  35. 5
  36. 3
  37. 6
  38. Stars
  39. 6
  40. False

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