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

Answer key

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

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