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

Answer key

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

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