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

Answer key

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

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