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

Answer key

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

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