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

Answer key

  1. True
  2. Monsoon
  3. 4
  4. Sunrise
  5. 2
  6. 5
  7. True
  8. your last game level
  9. a list
  10. 5
  11. in the cloud
  12. in the cloud
  13. 2
  14. a draft you are typing
  15. notes to read offline
  16. Aman
  17. in the cloud
  18. 5
  19. data saved on the phone
  20. on the phone
  21. Sunrise
  22. Hindi
  23. the sound on/off setting
  24. a named box for a value
  25. 7
  26. Hindi
  27. Art
  28. the phone is lost
  29. 4
  30. 4
  31. Science
  32. on the phone
  33. 5
  34. 3
  35. a class leaderboard
  36. 6
  37. 5
  38. use it on any device
  39. Maths
  40. 5

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