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

Answer key

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

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