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

Answer key

  1. 3
  2. on the phone
  3. True
  4. False
  5. Zoya
  6. Riya
  7. the phone is lost
  8. 8
  9. 4
  10. Kabir
  11. in the cloud
  12. Stars
  13. Zoya
  14. Riya
  15. Ocean
  16. Music
  17. False
  18. on the phone
  19. Arjun
  20. photos on two devices
  21. a class leaderboard
  22. 4
  23. Sports
  24. on the phone
  25. 0
  26. data saved on the phone
  27. use it on any device
  28. on the phone
  29. 3
  30. 4
  31. 4
  32. Kites
  33. Kabir
  34. in the cloud
  35. Aman
  36. Kabir
  37. Music
  38. True
  39. False
  40. Maths

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