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

Answer key

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

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