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

Answer key

  1. chat messages to friends
  2. False
  3. a list
  4. Aman
  5. Stars
  6. 4
  7. on the phone
  8. in the cloud
  9. 5
  10. a draft you are typing
  11. Art
  12. Rain
  13. Stars
  14. Ocean
  15. use it on any device
  16. 5
  17. False
  18. True
  19. in the cloud
  20. a named box for a value
  21. notes to read offline
  22. Sports
  23. 3
  24. on the phone
  25. the phone is lost
  26. a class leaderboard
  27. 6
  28. False
  29. photos on two devices
  30. the sound on/off setting
  31. 4
  32. False
  33. Stars
  34. Sunrise
  35. in the cloud
  36. Stars
  37. in the cloud
  38. Maths
  39. 0
  40. on the phone

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