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

Answer key

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

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