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

Answer key

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

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