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

Answer key

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

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