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

Answer key

  1. Zoya
  2. Rain
  3. 2
  4. Science
  5. the phone is lost
  6. 5
  7. Monsoon
  8. Hindi
  9. a named box for a value
  10. True
  11. 10
  12. False
  13. Kites
  14. 5
  15. notes to read offline
  16. 5
  17. Hindi
  18. 4
  19. data saved on the phone
  20. False
  21. a class leaderboard
  22. 5
  23. on the phone
  24. 4
  25. 5
  26. Sunrise
  27. a shared to-do list
  28. 1
  29. True
  30. your last game level
  31. in the cloud
  32. photos on two devices
  33. 4
  34. Kites
  35. in the cloud
  36. False
  37. on the phone
  38. on the phone
  39. 4
  40. Meera

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