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

Answer key

  1. True
  2. 5
  3. Art
  4. 3
  5. in the cloud
  6. 6
  7. a list
  8. True
  9. data saved on the phone
  10. Kabir
  11. on the phone
  12. False
  13. Hindi
  14. Sunrise
  15. Stars
  16. 7
  17. on the phone
  18. Sports
  19. Stars
  20. False
  21. on the phone
  22. a named box for a value
  23. 6
  24. 3
  25. a class leaderboard
  26. in the cloud
  27. Music
  28. Riya
  29. False
  30. 4
  31. the phone is lost
  32. photos on two devices
  33. use it on any device
  34. a shared to-do list
  35. True
  36. 5
  37. False
  38. Riya
  39. 5
  40. 0

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