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

Answer key

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

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