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

Answer key

  1. Stars
  2. Hindi
  3. on the phone
  4. Zoya
  5. a named box for a value
  6. the phone is lost
  7. a list
  8. False
  9. 6
  10. Kabir
  11. notes to read offline
  12. in the cloud
  13. Science
  14. False
  15. 9
  16. 4
  17. 6
  18. Stars
  19. your last game level
  20. True
  21. on the phone
  22. Maths
  23. Kites
  24. data saved on the phone
  25. True
  26. 3
  27. Ocean
  28. True
  29. Music
  30. 9
  31. False
  32. Kites
  33. a draft you are typing
  34. in the cloud
  35. 6
  36. False
  37. a shared to-do list
  38. 10
  39. False
  40. Sports

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