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

Answer key

  1. 5
  2. Riya
  3. a class leaderboard
  4. in the cloud
  5. 3
  6. notes to read offline
  7. Zoya
  8. 10
  9. your last game level
  10. photos on two devices
  11. Sunrise
  12. on the phone
  13. True
  14. False
  15. in the cloud
  16. 4
  17. Aman
  18. Science
  19. 4
  20. Stars
  21. Stars
  22. 4
  23. 9
  24. 11
  25. the phone is lost
  26. 6
  27. on the phone
  28. 3
  29. 4
  30. 3
  31. Hindi
  32. Music
  33. 5
  34. 5
  35. 5
  36. Kites
  37. Music
  38. True
  39. True
  40. on the phone

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