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

Answer key

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

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