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

Answer key

  1. 3
  2. a list
  3. on the phone
  4. 4
  5. True
  6. Art
  7. Stars
  8. Riya
  9. notes to read offline
  10. 0
  11. a named box for a value
  12. False
  13. False
  14. in the cloud
  15. 5
  16. 10
  17. True
  18. 4
  19. False
  20. Science
  21. 6
  22. a class leaderboard
  23. 4
  24. False
  25. 4
  26. on the phone
  27. on the phone
  28. Sunrise
  29. Kabir
  30. Stars
  31. in the cloud
  32. a shared to-do list
  33. the sound on/off setting
  34. 3
  35. a draft you are typing
  36. 4
  37. False
  38. 4
  39. 8
  40. photos on two devices

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