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

Answer key

  1. a shared to-do list
  2. on the phone
  3. your last game level
  4. chat messages to friends
  5. Sports
  6. data saved on the phone
  7. True
  8. True
  9. False
  10. Kites
  11. 3
  12. 5
  13. Riya
  14. a named box for a value
  15. a draft you are typing
  16. 0
  17. in the cloud
  18. 3
  19. a list
  20. 4
  21. in the cloud
  22. Riya
  23. Arjun
  24. in the cloud
  25. use it on any device
  26. Rain
  27. 3
  28. Science
  29. in the cloud
  30. True
  31. 6
  32. Ocean
  33. a class leaderboard
  34. False
  35. Kabir
  36. Art
  37. Art
  38. 3
  39. Rain
  40. 2

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