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

Answer key

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

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