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

Answer key

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

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