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

Answer key

  1. False
  2. a named box for a value
  3. 3
  4. 4
  5. data saved on the phone
  6. in the cloud
  7. Science
  8. Ocean
  9. Rain
  10. 4
  11. Monsoon
  12. a list
  13. Monsoon
  14. your last game level
  15. 5
  16. 4
  17. 3
  18. 3
  19. 10
  20. on the phone
  21. 5
  22. 5
  23. on the phone
  24. in the cloud
  25. Aman
  26. use it on any device
  27. False
  28. Meera
  29. notes to read offline
  30. photos on two devices
  31. the phone is lost
  32. Arjun
  33. Stars
  34. Stars
  35. a draft you are typing
  36. chat messages to friends
  37. in the cloud
  38. 4
  39. Science
  40. True

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