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

Answer key

  1. 5
  2. Rain
  3. notes to read offline
  4. 3
  5. in the cloud
  6. 5
  7. chat messages to friends
  8. the sound on/off setting
  9. True
  10. 6
  11. True
  12. a class leaderboard
  13. 3
  14. Stars
  15. True
  16. 5
  17. False
  18. 2
  19. Sports
  20. on the phone
  21. False
  22. use it on any device
  23. 5
  24. on the phone
  25. Hindi
  26. 0
  27. a draft you are typing
  28. Sports
  29. Monsoon
  30. 4
  31. a named box for a value
  32. 4
  33. 4
  34. Stars
  35. False
  36. 4
  37. 10
  38. 8
  39. Ocean
  40. True

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