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

Answer key

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

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