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

Answer key

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

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