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

Answer key

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

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