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

Answer key

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

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