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

Answer key

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

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