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

Answer key

  1. in the cloud
  2. True
  3. 4
  4. a class leaderboard
  5. a shared to-do list
  6. 5
  7. Arjun
  8. the phone is lost
  9. 3
  10. Arjun
  11. photos on two devices
  12. Sunrise
  13. 0
  14. False
  15. 6
  16. 8
  17. Kabir
  18. data saved on the phone
  19. Sunrise
  20. False
  21. 3
  22. in the cloud
  23. notes to read offline
  24. True
  25. your last game level
  26. 5
  27. True
  28. 5
  29. on the phone
  30. in the cloud
  31. Riya
  32. Zoya
  33. chat messages to friends
  34. Hindi
  35. Rain
  36. 5
  37. 6
  38. True
  39. on the phone
  40. 5

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