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

Answer key

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

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