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

Answer key

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

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