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

Answer key

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

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