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

Answer key

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

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