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

Answer key

  1. 4
  2. your last game level
  3. chat messages to friends
  4. on the phone
  5. 0
  6. False
  7. True
  8. 5
  9. Science
  10. True
  11. in the cloud
  12. True
  13. False
  14. a list
  15. Arjun
  16. False
  17. 7
  18. on the phone
  19. 5
  20. Monsoon
  21. 5
  22. False
  23. a draft you are typing
  24. 4
  25. on the phone
  26. 6
  27. a named box for a value
  28. 3
  29. data saved on the phone
  30. photos on two devices
  31. a class leaderboard
  32. in the cloud
  33. Riya
  34. the phone is lost
  35. the sound on/off setting
  36. Zoya
  37. True
  38. 6
  39. 7
  40. Sports

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