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

Answer key

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

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