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

Answer key

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

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