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

Answer key

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

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