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

Answer key

  1. Arjun
  2. a draft you are typing
  3. Riya
  4. True
  5. Hindi
  6. on the phone
  7. False
  8. photos on two devices
  9. 4
  10. 6
  11. Aman
  12. Aman
  13. 0
  14. False
  15. on the phone
  16. on the phone
  17. True
  18. Art
  19. chat messages to friends
  20. 6
  21. 5
  22. Ocean
  23. Kites
  24. data saved on the phone
  25. 5
  26. a shared to-do list
  27. True
  28. Arjun
  29. a list
  30. the phone is lost
  31. False
  32. Hindi
  33. in the cloud
  34. in the cloud
  35. 6
  36. the sound on/off setting
  37. True
  38. in the cloud
  39. 3
  40. 5

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