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

Answer key

  1. 0
  2. Monsoon
  3. a shared to-do list
  4. Monsoon
  5. a named box for a value
  6. on the phone
  7. your last game level
  8. 4
  9. False
  10. on the phone
  11. in the cloud
  12. True
  13. Stars
  14. in the cloud
  15. on the phone
  16. 5
  17. Monsoon
  18. False
  19. 6
  20. 6
  21. Kabir
  22. notes to read offline
  23. 11
  24. True
  25. 3
  26. True
  27. 3
  28. Science
  29. Ocean
  30. 3
  31. a list
  32. Art
  33. 4
  34. 4
  35. 6
  36. chat messages to friends
  37. use it on any device
  38. Maths
  39. Riya
  40. 6

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