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

Answer key

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

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