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

Answer key

  1. False
  2. True
  3. the phone is lost
  4. 0
  5. Stars
  6. True
  7. on the phone
  8. 7
  9. your last game level
  10. 6
  11. data saved on the phone
  12. notes to read offline
  13. use it on any device
  14. Science
  15. the sound on/off setting
  16. 5
  17. 4
  18. 4
  19. photos on two devices
  20. Science
  21. Ocean
  22. False
  23. 4
  24. 4
  25. in the cloud
  26. 5
  27. a named box for a value
  28. Maths
  29. a class leaderboard
  30. 3
  31. 4
  32. Ocean
  33. False
  34. in the cloud
  35. on the phone
  36. False
  37. 6
  38. 11
  39. 4
  40. in the cloud

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