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

Answer key

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

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