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

Answer key

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

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