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

Answer key

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

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