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

Answer key

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

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