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

Answer key

  1. 3
  2. the phone is lost
  3. 3
  4. a shared to-do list
  5. your last game level
  6. in the cloud
  7. 6
  8. False
  9. a list
  10. use it on any device
  11. notes to read offline
  12. False
  13. in the cloud
  14. on the phone
  15. 5
  16. Art
  17. a named box for a value
  18. True
  19. data saved on the phone
  20. False
  21. Hindi
  22. the sound on/off setting
  23. Hindi
  24. 7
  25. Kabir
  26. True
  27. Aman
  28. False
  29. 0
  30. Stars
  31. on the phone
  32. Aman
  33. Music
  34. True
  35. Science
  36. 10
  37. 5
  38. False
  39. a class leaderboard
  40. 4

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