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

Answer key

  1. Ocean
  2. on the phone
  3. 1
  4. in the cloud
  5. False
  6. 5
  7. 12
  8. notes to read offline
  9. Sunrise
  10. Rain
  11. chat messages to friends
  12. on the phone
  13. Sunrise
  14. in the cloud
  15. True
  16. the phone is lost
  17. 5
  18. 5
  19. Sunrise
  20. 4
  21. Riya
  22. True
  23. Arjun
  24. True
  25. Music
  26. False
  27. Hindi
  28. data saved on the phone
  29. a list
  30. Maths
  31. Meera
  32. Hindi
  33. Art
  34. 4
  35. True
  36. on the phone
  37. 5
  38. Science
  39. 7
  40. Ocean

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