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

Answer key

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

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