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

Answer key

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

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