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

Answer key

  1. notes to read offline
  2. Rain
  3. photos on two devices
  4. Zoya
  5. chat messages to friends
  6. on the phone
  7. data saved on the phone
  8. False
  9. Art
  10. False
  11. Stars
  12. 5
  13. 5
  14. on the phone
  15. 6
  16. Rain
  17. a class leaderboard
  18. your last game level
  19. 5
  20. on the phone
  21. 6
  22. 5
  23. a list
  24. Ocean
  25. False
  26. True
  27. a shared to-do list
  28. the sound on/off setting
  29. 5
  30. in the cloud
  31. Aman
  32. Art
  33. 4
  34. True
  35. 7
  36. in the cloud
  37. True
  38. Kites
  39. 0
  40. the phone is lost

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