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

Answer key

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

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