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

Answer key

  1. a draft you are typing
  2. Sunrise
  3. in the cloud
  4. in the cloud
  5. 9
  6. the phone is lost
  7. a list
  8. False
  9. on the phone
  10. Zoya
  11. 4
  12. False
  13. 3
  14. Music
  15. Riya
  16. False
  17. False
  18. True
  19. chat messages to friends
  20. 3
  21. Stars
  22. data saved on the phone
  23. 6
  24. 0
  25. a named box for a value
  26. Music
  27. 4
  28. Hindi
  29. Art
  30. on the phone
  31. True
  32. 5
  33. 5
  34. a shared to-do list
  35. True
  36. on the phone
  37. Sunrise
  38. True
  39. in the cloud
  40. Kites

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