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

Answer key

  1. Art
  2. True
  3. Art
  4. the phone is lost
  5. 0
  6. Science
  7. True
  8. the sound on/off setting
  9. in the cloud
  10. Kabir
  11. False
  12. on the phone
  13. on the phone
  14. use it on any device
  15. 5
  16. Science
  17. Science
  18. notes to read offline
  19. 1
  20. False
  21. Sunrise
  22. 5
  23. True
  24. True
  25. False
  26. False
  27. in the cloud
  28. 5
  29. 5
  30. Meera
  31. a draft you are typing
  32. 4
  33. Rain
  34. 2
  35. True
  36. chat messages to friends
  37. 6
  38. True
  39. Ocean
  40. False

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