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

Answer key

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

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