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

Answer key

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

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