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

Answer key

  1. a named box for a value
  2. on the phone
  3. False
  4. 4
  5. Kites
  6. Sports
  7. notes to read offline
  8. Aman
  9. 5
  10. 3
  11. on the phone
  12. the sound on/off setting
  13. on the phone
  14. 0
  15. in the cloud
  16. in the cloud
  17. in the cloud
  18. Kites
  19. Ocean
  20. False
  21. 7
  22. photos on two devices
  23. data saved on the phone
  24. your last game level
  25. Rain
  26. True
  27. a class leaderboard
  28. Aman
  29. 5
  30. 3
  31. Science
  32. chat messages to friends
  33. Zoya
  34. Kites
  35. Maths
  36. Rain
  37. Aman
  38. False
  39. False
  40. True

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