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

Answer key

  1. 3
  2. True
  3. 5
  4. 6
  5. Kites
  6. data saved on the phone
  7. Stars
  8. use it on any device
  9. in the cloud
  10. False
  11. a list
  12. chat messages to friends
  13. Riya
  14. 6
  15. on the phone
  16. Kites
  17. True
  18. a draft you are typing
  19. in the cloud
  20. Maths
  21. in the cloud
  22. 2
  23. the phone is lost
  24. 5
  25. on the phone
  26. Ocean
  27. Kabir
  28. False
  29. False
  30. False
  31. 9
  32. a shared to-do list
  33. Kites
  34. 1
  35. Rain
  36. Stars
  37. 5
  38. in the cloud
  39. 0
  40. Kabir

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