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

Answer key

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

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