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

Answer key

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

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