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

Answer key

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

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