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

Answer key

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

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