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

Answer key

  1. Ocean
  2. on the phone
  3. a list
  4. Ocean
  5. 4
  6. Music
  7. 4
  8. True
  9. in the cloud
  10. the phone is lost
  11. False
  12. Kites
  13. 3
  14. on the phone
  15. Rain
  16. False
  17. in the cloud
  18. on the phone
  19. 0
  20. on the phone
  21. 6
  22. 4
  23. 6
  24. Music
  25. Sunrise
  26. photos on two devices
  27. Sunrise
  28. True
  29. 7
  30. 3
  31. in the cloud
  32. a class leaderboard
  33. the sound on/off setting
  34. 4
  35. in the cloud
  36. 4
  37. 3
  38. Science
  39. use it on any device
  40. Rain

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