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

Answer key

  1. Art
  2. False
  3. 0
  4. in the cloud
  5. a list
  6. True
  7. in the cloud
  8. Rain
  9. on the phone
  10. chat messages to friends
  11. Kabir
  12. True
  13. your last game level
  14. Meera
  15. 4
  16. Sunrise
  17. on the phone
  18. Music
  19. on the phone
  20. 3
  21. notes to read offline
  22. photos on two devices
  23. Sports
  24. 3
  25. use it on any device
  26. 4
  27. 4
  28. 5
  29. Sunrise
  30. Ocean
  31. Ocean
  32. in the cloud
  33. in the cloud
  34. 5
  35. 4
  36. Maths
  37. Aman
  38. Music
  39. True
  40. a draft you are typing

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