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

Answer key

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

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