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

Answer key

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

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