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

Answer key

  1. the phone is lost
  2. photos on two devices
  3. Arjun
  4. Rain
  5. Maths
  6. in the cloud
  7. a named box for a value
  8. 5
  9. Ocean
  10. use it on any device
  11. a list
  12. on the phone
  13. Zoya
  14. Ocean
  15. on the phone
  16. Art
  17. 5
  18. Riya
  19. Aman
  20. 5
  21. True
  22. Ocean
  23. True
  24. Art
  25. Ocean
  26. on the phone
  27. True
  28. Hindi
  29. in the cloud
  30. 0
  31. 4
  32. Zoya
  33. True
  34. 8
  35. 9
  36. in the cloud
  37. Sunrise
  38. False
  39. 5
  40. True

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