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

Answer key

  1. Riya
  2. Stars
  3. True
  4. a list
  5. True
  6. 4
  7. in the cloud
  8. the sound on/off setting
  9. Rain
  10. True
  11. False
  12. False
  13. 11
  14. a draft you are typing
  15. on the phone
  16. in the cloud
  17. 4
  18. 5
  19. a shared to-do list
  20. 4
  21. Arjun
  22. False
  23. in the cloud
  24. Sunrise
  25. False
  26. Hindi
  27. 4
  28. Hindi
  29. on the phone
  30. 5
  31. 5
  32. Music
  33. on the phone
  34. True
  35. on the phone
  36. 0
  37. notes to read offline
  38. use it on any device
  39. Sports
  40. True

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