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

Answer key

  1. a list
  2. photos on two devices
  3. Monsoon
  4. Maths
  5. 3
  6. False
  7. True
  8. False
  9. on the phone
  10. chat messages to friends
  11. 6
  12. Aman
  13. Riya
  14. Meera
  15. your last game level
  16. in the cloud
  17. 0
  18. on the phone
  19. notes to read offline
  20. Maths
  21. a shared to-do list
  22. on the phone
  23. 4
  24. 6
  25. 1
  26. data saved on the phone
  27. a draft you are typing
  28. 9
  29. 3
  30. Sports
  31. 5
  32. on the phone
  33. Science
  34. in the cloud
  35. 5
  36. 9
  37. Ocean
  38. 5
  39. False
  40. 6

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