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

Answer key

  1. False
  2. 6
  3. on the phone
  4. Riya
  5. on the phone
  6. Stars
  7. a draft you are typing
  8. Kites
  9. on the phone
  10. False
  11. a class leaderboard
  12. 5
  13. notes to read offline
  14. Aman
  15. your last game level
  16. Rain
  17. Riya
  18. 3
  19. 0
  20. True
  21. use it on any device
  22. False
  23. True
  24. on the phone
  25. 5
  26. in the cloud
  27. Maths
  28. 3
  29. in the cloud
  30. False
  31. 4
  32. photos on two devices
  33. 6
  34. a list
  35. in the cloud
  36. False
  37. 3
  38. Science
  39. 5
  40. False

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