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

Answer key

  1. your last game level
  2. False
  3. 4
  4. in the cloud
  5. 3
  6. a named box for a value
  7. on the phone
  8. 1
  9. on the phone
  10. Kabir
  11. 5
  12. Zoya
  13. False
  14. in the cloud
  15. True
  16. in the cloud
  17. chat messages to friends
  18. 4
  19. the sound on/off setting
  20. notes to read offline
  21. Ocean
  22. on the phone
  23. a draft you are typing
  24. 4
  25. use it on any device
  26. a list
  27. False
  28. True
  29. 6
  30. Kites
  31. in the cloud
  32. Music
  33. Meera
  34. 0
  35. 5
  36. 3
  37. 3
  38. False
  39. Hindi
  40. Meera

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