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

Answer key

  1. 4
  2. photos on two devices
  3. Stars
  4. 10
  5. Aman
  6. Rain
  7. 3
  8. True
  9. Meera
  10. True
  11. 0
  12. False
  13. 5
  14. False
  15. a list
  16. 5
  17. on the phone
  18. chat messages to friends
  19. Meera
  20. on the phone
  21. in the cloud
  22. 4
  23. a draft you are typing
  24. Arjun
  25. 4
  26. in the cloud
  27. the sound on/off setting
  28. 5
  29. use it on any device
  30. data saved on the phone
  31. Meera
  32. a class leaderboard
  33. Meera
  34. the phone is lost
  35. Sports
  36. notes to read offline
  37. in the cloud
  38. Hindi
  39. 4
  40. 6

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