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

Answer key

  1. 5
  2. on the phone
  3. False
  4. in the cloud
  5. 6
  6. Hindi
  7. on the phone
  8. a class leaderboard
  9. 3
  10. Ocean
  11. 10
  12. a list
  13. the sound on/off setting
  14. a draft you are typing
  15. in the cloud
  16. 8
  17. 4
  18. use it on any device
  19. Ocean
  20. Hindi
  21. a named box for a value
  22. Zoya
  23. False
  24. True
  25. 2
  26. False
  27. Kabir
  28. False
  29. in the cloud
  30. Monsoon
  31. photos on two devices
  32. Monsoon
  33. in the cloud
  34. 4
  35. data saved on the phone
  36. Kabir
  37. False
  38. 10
  39. 4
  40. on the phone

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