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

Answer key

  1. a named box for a value
  2. True
  3. False
  4. True
  5. 5
  6. 5
  7. in the cloud
  8. photos on two devices
  9. on the phone
  10. Hindi
  11. notes to read offline
  12. True
  13. 0
  14. Monsoon
  15. a shared to-do list
  16. Sports
  17. the phone is lost
  18. a list
  19. a class leaderboard
  20. Science
  21. Science
  22. 5
  23. False
  24. 4
  25. Arjun
  26. Ocean
  27. 4
  28. on the phone
  29. False
  30. in the cloud
  31. chat messages to friends
  32. in the cloud
  33. Science
  34. Sports
  35. Zoya
  36. False
  37. Hindi
  38. the sound on/off setting
  39. on the phone
  40. 4

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