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

Answer key

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

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