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

Answer key

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

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