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

Answer key

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

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