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

Answer key

  1. a named box for a value
  2. in the cloud
  3. chat messages to friends
  4. False
  5. in the cloud
  6. your last game level
  7. 3
  8. on the phone
  9. Music
  10. notes to read offline
  11. the sound on/off setting
  12. Music
  13. photos on two devices
  14. True
  15. Kabir
  16. 3
  17. data saved on the phone
  18. 5
  19. 5
  20. Art
  21. 6
  22. False
  23. a draft you are typing
  24. True
  25. Meera
  26. True
  27. 3
  28. 4
  29. False
  30. Aman
  31. 3
  32. on the phone
  33. a shared to-do list
  34. Riya
  35. True
  36. a list
  37. 6
  38. False
  39. Kites
  40. 6

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