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

Answer key

  1. on the phone
  2. on the phone
  3. Rain
  4. 0
  5. 4
  6. Kabir
  7. a named box for a value
  8. Riya
  9. Ocean
  10. Aman
  11. your last game level
  12. a shared to-do list
  13. on the phone
  14. False
  15. 6
  16. 4
  17. use it on any device
  18. True
  19. Hindi
  20. a draft you are typing
  21. False
  22. in the cloud
  23. 6
  24. Sports
  25. notes to read offline
  26. True
  27. a class leaderboard
  28. 3
  29. Ocean
  30. 3
  31. Meera
  32. Kites
  33. True
  34. a list
  35. Hindi
  36. 5
  37. True
  38. 4
  39. Science
  40. 2

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