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

Answer key

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

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