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

Answer key

  1. 6
  2. data saved on the phone
  3. the phone is lost
  4. True
  5. 4
  6. in the cloud
  7. Sunrise
  8. chat messages to friends
  9. Kites
  10. False
  11. on the phone
  12. Riya
  13. notes to read offline
  14. Riya
  15. the sound on/off setting
  16. False
  17. Kites
  18. Arjun
  19. True
  20. Ocean
  21. Rain
  22. 4
  23. a shared to-do list
  24. 3
  25. 6
  26. True
  27. Maths
  28. 6
  29. False
  30. on the phone
  31. a draft you are typing
  32. False
  33. a list
  34. False
  35. True
  36. 6
  37. 3
  38. Stars
  39. Art
  40. 5

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