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

Answer key

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

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