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

Answer key

  1. the phone is lost
  2. your last game level
  3. a list
  4. True
  5. in the cloud
  6. 4
  7. photos on two devices
  8. use it on any device
  9. in the cloud
  10. True
  11. 4
  12. 0
  13. False
  14. 5
  15. on the phone
  16. False
  17. False
  18. data saved on the phone
  19. 4
  20. Sunrise
  21. Aman
  22. Maths
  23. in the cloud
  24. 5
  25. 5
  26. Aman
  27. Hindi
  28. Sunrise
  29. on the phone
  30. a named box for a value
  31. a shared to-do list
  32. True
  33. Science
  34. 3
  35. Aman
  36. Kites
  37. 5
  38. Sunrise
  39. Music
  40. True

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