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

Answer key

  1. use it on any device
  2. 3
  3. True
  4. on the phone
  5. your last game level
  6. on the phone
  7. the sound on/off setting
  8. in the cloud
  9. Sunrise
  10. 8
  11. a named box for a value
  12. 0
  13. 4
  14. 5
  15. Monsoon
  16. 3
  17. 7
  18. 3
  19. in the cloud
  20. Monsoon
  21. 3
  22. Hindi
  23. on the phone
  24. notes to read offline
  25. Kabir
  26. 3
  27. 2
  28. a class leaderboard
  29. 2
  30. 2
  31. Monsoon
  32. in the cloud
  33. 6
  34. Rain
  35. 4
  36. False
  37. False
  38. False
  39. a draft you are typing
  40. in the cloud

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