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

Answer key

  1. Sunrise
  2. in the cloud
  3. photos on two devices
  4. False
  5. Sunrise
  6. Rain
  7. True
  8. a class leaderboard
  9. 5
  10. True
  11. Sunrise
  12. in the cloud
  13. False
  14. 7
  15. on the phone
  16. 4
  17. False
  18. on the phone
  19. True
  20. 9
  21. Zoya
  22. the sound on/off setting
  23. Rain
  24. 5
  25. 4
  26. 4
  27. 5
  28. Art
  29. 0
  30. Meera
  31. Sports
  32. your last game level
  33. 3
  34. Meera
  35. 5
  36. in the cloud
  37. 5
  38. a list
  39. 9
  40. a named box for a value

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