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

Answer key

  1. 4
  2. a class leaderboard
  3. your last game level
  4. in the cloud
  5. Zoya
  6. a named box for a value
  7. 3
  8. Riya
  9. a list
  10. chat messages to friends
  11. 0
  12. False
  13. use it on any device
  14. 4
  15. 5
  16. a draft you are typing
  17. Aman
  18. Rain
  19. 4
  20. 8
  21. False
  22. Ocean
  23. False
  24. False
  25. 4
  26. 8
  27. 2
  28. in the cloud
  29. on the phone
  30. a shared to-do list
  31. True
  32. the phone is lost
  33. True
  34. Hindi
  35. 5
  36. True
  37. photos on two devices
  38. Rain
  39. 11
  40. 3

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