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

Answer key

  1. Music
  2. True
  3. use it on any device
  4. False
  5. 6
  6. True
  7. 4
  8. data saved on the phone
  9. on the phone
  10. a class leaderboard
  11. a draft you are typing
  12. the sound on/off setting
  13. Science
  14. Sports
  15. False
  16. 5
  17. Sports
  18. 4
  19. False
  20. in the cloud
  21. notes to read offline
  22. Ocean
  23. photos on two devices
  24. Ocean
  25. Kites
  26. in the cloud
  27. on the phone
  28. 8
  29. Meera
  30. 0
  31. 4
  32. Rain
  33. 5
  34. 5
  35. Arjun
  36. False
  37. 3
  38. Rain
  39. False
  40. in the cloud

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