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

Answer key

  1. Science
  2. Rain
  3. Stars
  4. Maths
  5. on the phone
  6. the sound on/off setting
  7. Aman
  8. True
  9. a list
  10. on the phone
  11. Hindi
  12. Zoya
  13. in the cloud
  14. a class leaderboard
  15. photos on two devices
  16. in the cloud
  17. 0
  18. True
  19. 2
  20. on the phone
  21. Zoya
  22. Stars
  23. False
  24. Hindi
  25. False
  26. notes to read offline
  27. Sports
  28. Art
  29. your last game level
  30. Kites
  31. False
  32. Arjun
  33. 4
  34. Maths
  35. 3
  36. 4
  37. data saved on the phone
  38. True
  39. 8
  40. False

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