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

Answer key

  1. the phone is lost
  2. Music
  3. in the cloud
  4. on the phone
  5. a shared to-do list
  6. True
  7. notes to read offline
  8. in the cloud
  9. 7
  10. 0
  11. Stars
  12. False
  13. the sound on/off setting
  14. True
  15. 6
  16. Sports
  17. 4
  18. Zoya
  19. True
  20. your last game level
  21. a class leaderboard
  22. a list
  23. Monsoon
  24. Kabir
  25. Science
  26. 3
  27. 6
  28. chat messages to friends
  29. in the cloud
  30. data saved on the phone
  31. Maths
  32. Sports
  33. Art
  34. True
  35. 5
  36. False
  37. Meera
  38. Sunrise
  39. 6
  40. 6

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