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

Answer key

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

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