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

Answer key

  1. True
  2. a draft you are typing
  3. in the cloud
  4. False
  5. data saved on the phone
  6. 6
  7. True
  8. on the phone
  9. on the phone
  10. your last game level
  11. notes to read offline
  12. True
  13. 0
  14. True
  15. Rain
  16. 4
  17. in the cloud
  18. on the phone
  19. 5
  20. 4
  21. True
  22. in the cloud
  23. False
  24. 3
  25. Science
  26. 10
  27. 4
  28. 9
  29. a named box for a value
  30. a list
  31. False
  32. Hindi
  33. 4
  34. 5
  35. False
  36. 4
  37. Sunrise
  38. Art
  39. 5
  40. Riya

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