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

Answer key

  1. a list
  2. True
  3. use it on any device
  4. the phone is lost
  5. 4
  6. False
  7. False
  8. 8
  9. 4
  10. in the cloud
  11. 3
  12. Maths
  13. Zoya
  14. on the phone
  15. your last game level
  16. 0
  17. Hindi
  18. Stars
  19. on the phone
  20. the sound on/off setting
  21. 5
  22. on the phone
  23. notes to read offline
  24. Maths
  25. Arjun
  26. Art
  27. in the cloud
  28. True
  29. 5
  30. True
  31. 4
  32. photos on two devices
  33. a named box for a value
  34. Kabir
  35. False
  36. True
  37. Sunrise
  38. False
  39. 3
  40. a draft you are typing

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