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

Answer key

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

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