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

Answer key

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

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