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

Answer key

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

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