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

Answer key

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

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