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

Answer key

  1. chat messages to friends
  2. a shared to-do list
  3. on the phone
  4. Rain
  5. a draft you are typing
  6. False
  7. Sunrise
  8. Zoya
  9. in the cloud
  10. on the phone
  11. 6
  12. 6
  13. True
  14. True
  15. the sound on/off setting
  16. in the cloud
  17. Kabir
  18. Maths
  19. notes to read offline
  20. 6
  21. 5
  22. Kabir
  23. 0
  24. 3
  25. 3
  26. Sports
  27. in the cloud
  28. a list
  29. 5
  30. a named box for a value
  31. False
  32. the phone is lost
  33. Art
  34. data saved on the phone
  35. True
  36. Zoya
  37. 1
  38. on the phone
  39. 6
  40. 10

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