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

Answer key

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

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