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

Answer key

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

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