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

Answer key

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

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