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

Answer key

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

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