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

Answer key

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

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