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

Answer key

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

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