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

Answer key

  1. False
  2. Stars
  3. True
  4. in the cloud
  5. a named box for a value
  6. in the cloud
  7. a class leaderboard
  8. 6
  9. Kabir
  10. Maths
  11. chat messages to friends
  12. 0
  13. Science
  14. 3
  15. in the cloud
  16. False
  17. False
  18. the phone is lost
  19. True
  20. False
  21. Kabir
  22. in the cloud
  23. 3
  24. Ocean
  25. Hindi
  26. Arjun
  27. photos on two devices
  28. True
  29. Riya
  30. on the phone
  31. Sports
  32. Rain
  33. 4
  34. False
  35. Stars
  36. Rain
  37. on the phone
  38. Hindi
  39. 6
  40. 4

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