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

Answer key

  1. Zoya
  2. in the cloud
  3. a draft you are typing
  4. True
  5. Arjun
  6. a list
  7. Stars
  8. in the cloud
  9. chat messages to friends
  10. notes to read offline
  11. 5
  12. Maths
  13. 5
  14. 4
  15. the sound on/off setting
  16. in the cloud
  17. Riya
  18. True
  19. on the phone
  20. a shared to-do list
  21. False
  22. True
  23. Hindi
  24. photos on two devices
  25. 6
  26. a class leaderboard
  27. 5
  28. True
  29. True
  30. Art
  31. 2
  32. on the phone
  33. 7
  34. Riya
  35. 5
  36. Stars
  37. Maths
  38. 4
  39. 4
  40. 5

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