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

Answer key

  1. Ocean
  2. in the cloud
  3. notes to read offline
  4. Ocean
  5. on the phone
  6. Arjun
  7. 5
  8. Kites
  9. in the cloud
  10. a list
  11. your last game level
  12. photos on two devices
  13. True
  14. False
  15. Art
  16. 4
  17. data saved on the phone
  18. Hindi
  19. Hindi
  20. True
  21. Sports
  22. in the cloud
  23. 0
  24. 4
  25. Sunrise
  26. a named box for a value
  27. on the phone
  28. 3
  29. use it on any device
  30. 4
  31. on the phone
  32. False
  33. the sound on/off setting
  34. 7
  35. Kabir
  36. Sunrise
  37. 4
  38. 4
  39. in the cloud
  40. Stars

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