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

Answer key

  1. Aman
  2. 3
  3. 0
  4. a list
  5. Maths
  6. photos on two devices
  7. 6
  8. a shared to-do list
  9. Sunrise
  10. 2
  11. a draft you are typing
  12. True
  13. chat messages to friends
  14. on the phone
  15. False
  16. on the phone
  17. True
  18. 6
  19. the sound on/off setting
  20. on the phone
  21. 3
  22. in the cloud
  23. Kites
  24. 9
  25. notes to read offline
  26. in the cloud
  27. 9
  28. the phone is lost
  29. True
  30. Sunrise
  31. on the phone
  32. Kites
  33. False
  34. Riya
  35. a class leaderboard
  36. data saved on the phone
  37. Meera
  38. Sunrise
  39. 4
  40. your last game level

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