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

Answer key

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

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