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

Answer key

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

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