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

Answer key

  1. your last game level
  2. on the phone
  3. a shared to-do list
  4. False
  5. a list
  6. notes to read offline
  7. False
  8. a draft you are typing
  9. 3
  10. the phone is lost
  11. Stars
  12. a class leaderboard
  13. False
  14. 5
  15. 3
  16. False
  17. 9
  18. in the cloud
  19. Hindi
  20. 5
  21. chat messages to friends
  22. Zoya
  23. Art
  24. 5
  25. Sports
  26. Art
  27. 4
  28. the sound on/off setting
  29. Kabir
  30. 4
  31. Art
  32. 4
  33. a named box for a value
  34. 4
  35. 3
  36. Art
  37. 5
  38. True
  39. 3
  40. data saved on the phone

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