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

Answer key

  1. a class leaderboard
  2. on the phone
  3. 0
  4. a named box for a value
  5. Sunrise
  6. False
  7. the phone is lost
  8. True
  9. True
  10. 3
  11. 5
  12. a shared to-do list
  13. Riya
  14. notes to read offline
  15. on the phone
  16. False
  17. False
  18. on the phone
  19. 3
  20. a list
  21. 4
  22. False
  23. your last game level
  24. 2
  25. 2
  26. in the cloud
  27. Rain
  28. in the cloud
  29. 5
  30. use it on any device
  31. the sound on/off setting
  32. 6
  33. 4
  34. False
  35. 4
  36. 5
  37. Science
  38. Maths
  39. Aman
  40. 2

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