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

Answer key

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

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