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

Answer key

  1. a named box for a value
  2. 3
  3. in the cloud
  4. True
  5. the phone is lost
  6. data saved on the phone
  7. True
  8. 5
  9. False
  10. 6
  11. True
  12. Hindi
  13. in the cloud
  14. Kites
  15. on the phone
  16. Art
  17. False
  18. False
  19. 0
  20. 7
  21. a list
  22. Maths
  23. False
  24. True
  25. False
  26. 4
  27. True
  28. False
  29. 4
  30. Music
  31. on the phone
  32. False
  33. Aman
  34. a class leaderboard
  35. in the cloud
  36. 5
  37. 4
  38. False
  39. chat messages to friends
  40. Zoya

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