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

Answer key

  1. Maths
  2. a named box for a value
  3. False
  4. use it on any device
  5. 8
  6. your last game level
  7. in the cloud
  8. a draft you are typing
  9. 2
  10. Riya
  11. chat messages to friends
  12. a class leaderboard
  13. 0
  14. in the cloud
  15. Rain
  16. 2
  17. True
  18. the sound on/off setting
  19. 3
  20. 8
  21. 5
  22. False
  23. photos on two devices
  24. Riya
  25. False
  26. on the phone
  27. False
  28. True
  29. 5
  30. 6
  31. 3
  32. 4
  33. 5
  34. on the phone
  35. 6
  36. 4
  37. Meera
  38. in the cloud
  39. notes to read offline
  40. Rain

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