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

Answer key

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

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