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

Answer key

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

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