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

Answer key

  1. the phone is lost
  2. 4
  3. in the cloud
  4. on the phone
  5. in the cloud
  6. Aman
  7. 3
  8. False
  9. 4
  10. Kabir
  11. 5
  12. notes to read offline
  13. a draft you are typing
  14. 5
  15. Stars
  16. Aman
  17. 5
  18. data saved on the phone
  19. Music
  20. Stars
  21. a class leaderboard
  22. on the phone
  23. 3
  24. a list
  25. chat messages to friends
  26. on the phone
  27. in the cloud
  28. 5
  29. Sunrise
  30. 5
  31. 3
  32. Aman
  33. 7
  34. your last game level
  35. on the phone
  36. 5
  37. Aman
  38. Maths
  39. use it on any device
  40. False

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