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

Answer key

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

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