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

Answer key

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

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