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

Answer key

  1. 4
  2. data saved on the phone
  3. Art
  4. Monsoon
  5. use it on any device
  6. in the cloud
  7. True
  8. 2
  9. on the phone
  10. Zoya
  11. photos on two devices
  12. chat messages to friends
  13. Ocean
  14. 5
  15. True
  16. False
  17. a list
  18. Hindi
  19. Aman
  20. the sound on/off setting
  21. notes to read offline
  22. on the phone
  23. 4
  24. 5
  25. Stars
  26. 4
  27. 0
  28. Aman
  29. Kites
  30. Hindi
  31. on the phone
  32. Music
  33. in the cloud
  34. your last game level
  35. in the cloud
  36. 4
  37. False
  38. 4
  39. 5
  40. False

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