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

Answer key

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

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