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

Answer key

  1. Monsoon
  2. Sports
  3. 6
  4. 3
  5. False
  6. notes to read offline
  7. True
  8. in the cloud
  9. 4
  10. 5
  11. 4
  12. data saved on the phone
  13. Sunrise
  14. a list
  15. the phone is lost
  16. on the phone
  17. Sunrise
  18. a class leaderboard
  19. chat messages to friends
  20. on the phone
  21. False
  22. 5
  23. 3
  24. 4
  25. 4
  26. 5
  27. a shared to-do list
  28. 7
  29. Science
  30. Hindi
  31. photos on two devices
  32. Ocean
  33. False
  34. True
  35. in the cloud
  36. in the cloud
  37. True
  38. True
  39. 5
  40. 0

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