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

Answer key

  1. a draft you are typing
  2. 8
  3. 4
  4. Arjun
  5. 3
  6. the sound on/off setting
  7. 5
  8. use it on any device
  9. 5
  10. Hindi
  11. True
  12. 3
  13. on the phone
  14. 4
  15. 3
  16. Zoya
  17. chat messages to friends
  18. False
  19. 5
  20. in the cloud
  21. False
  22. 6
  23. 10
  24. a shared to-do list
  25. True
  26. Ocean
  27. 5
  28. Art
  29. 5
  30. 0
  31. your last game level
  32. True
  33. 5
  34. 6
  35. True
  36. 5
  37. False
  38. Stars
  39. True
  40. on the phone

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