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

Answer key

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

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