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

Answer key

  1. Hindi
  2. the phone is lost
  3. 0
  4. 4
  5. True
  6. False
  7. 5
  8. Aman
  9. 6
  10. in the cloud
  11. 4
  12. 5
  13. Kites
  14. Science
  15. True
  16. a class leaderboard
  17. Riya
  18. a list
  19. Zoya
  20. 3
  21. 7
  22. False
  23. notes to read offline
  24. True
  25. on the phone
  26. False
  27. Kabir
  28. on the phone
  29. 6
  30. the sound on/off setting
  31. 4
  32. in the cloud
  33. a shared to-do list
  34. 3
  35. Science
  36. 6
  37. 4
  38. in the cloud
  39. photos on two devices
  40. True

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