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

Answer key

  1. 2
  2. on the phone
  3. 4
  4. Music
  5. True
  6. False
  7. a list
  8. 4
  9. True
  10. 4
  11. 4
  12. 5
  13. 8
  14. photos on two devices
  15. True
  16. Hindi
  17. a class leaderboard
  18. data saved on the phone
  19. Monsoon
  20. use it on any device
  21. True
  22. Science
  23. 0
  24. Hindi
  25. 4
  26. 1
  27. Music
  28. the phone is lost
  29. False
  30. False
  31. Arjun
  32. in the cloud
  33. notes to read offline
  34. True
  35. the sound on/off setting
  36. in the cloud
  37. a shared to-do list
  38. Music
  39. Science
  40. Music

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