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

Answer key

  1. 5
  2. a shared to-do list
  3. the phone is lost
  4. 4
  5. 6
  6. Hindi
  7. in the cloud
  8. False
  9. False
  10. Art
  11. use it on any device
  12. 5
  13. 2
  14. 3
  15. Riya
  16. 8
  17. 4
  18. 6
  19. 5
  20. a draft you are typing
  21. the sound on/off setting
  22. Music
  23. Art
  24. on the phone
  25. on the phone
  26. 6
  27. your last game level
  28. Stars
  29. notes to read offline
  30. photos on two devices
  31. data saved on the phone
  32. in the cloud
  33. 5
  34. Kites
  35. True
  36. 4
  37. a list
  38. 3
  39. Stars
  40. True

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