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

Answer key

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

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