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

Answer key

  1. a named box for a value
  2. on the phone
  3. in the cloud
  4. False
  5. 0
  6. False
  7. 5
  8. Stars
  9. a list
  10. False
  11. Zoya
  12. the sound on/off setting
  13. Aman
  14. Rain
  15. in the cloud
  16. photos on two devices
  17. 6
  18. Sunrise
  19. on the phone
  20. 5
  21. notes to read offline
  22. Monsoon
  23. 8
  24. Hindi
  25. False
  26. a class leaderboard
  27. on the phone
  28. 5
  29. True
  30. Kites
  31. Sunrise
  32. 4
  33. the phone is lost
  34. True
  35. 6
  36. True
  37. Arjun
  38. in the cloud
  39. Hindi
  40. on the phone

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