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

Answer key

  1. Science
  2. in the cloud
  3. 1
  4. chat messages to friends
  5. your last game level
  6. a class leaderboard
  7. the sound on/off setting
  8. Rain
  9. True
  10. False
  11. on the phone
  12. 8
  13. True
  14. Music
  15. False
  16. True
  17. 3
  18. 3
  19. 6
  20. on the phone
  21. in the cloud
  22. on the phone
  23. False
  24. notes to read offline
  25. 0
  26. the phone is lost
  27. Stars
  28. a list
  29. Arjun
  30. 4
  31. Zoya
  32. Aman
  33. a shared to-do list
  34. Hindi
  35. False
  36. a named box for a value
  37. 3
  38. Music
  39. 5
  40. False

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