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

Answer key

  1. Hindi
  2. False
  3. on the phone
  4. a list
  5. data saved on the phone
  6. Monsoon
  7. your last game level
  8. Monsoon
  9. Kites
  10. False
  11. 4
  12. 5
  13. in the cloud
  14. photos on two devices
  15. Stars
  16. a class leaderboard
  17. 4
  18. 3
  19. on the phone
  20. False
  21. Kabir
  22. on the phone
  23. Aman
  24. 5
  25. in the cloud
  26. 4
  27. a named box for a value
  28. False
  29. True
  30. 3
  31. use it on any device
  32. Hindi
  33. Sunrise
  34. in the cloud
  35. Art
  36. True
  37. Art
  38. Zoya
  39. 5
  40. chat messages to friends

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