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

Answer key

  1. Kites
  2. 4
  3. Sunrise
  4. 5
  5. notes to read offline
  6. 4
  7. on the phone
  8. 6
  9. 5
  10. 6
  11. in the cloud
  12. in the cloud
  13. a named box for a value
  14. on the phone
  15. chat messages to friends
  16. use it on any device
  17. True
  18. True
  19. in the cloud
  20. False
  21. 3
  22. Science
  23. False
  24. Kites
  25. on the phone
  26. Arjun
  27. 0
  28. Rain
  29. 5
  30. 3
  31. a class leaderboard
  32. Music
  33. True
  34. the phone is lost
  35. True
  36. False
  37. your last game level
  38. 3
  39. 4
  40. in the cloud

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