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

Answer key

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

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