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

Answer key

  1. Stars
  2. on the phone
  3. 4
  4. the sound on/off setting
  5. 6
  6. 3
  7. 5
  8. on the phone
  9. False
  10. True
  11. Monsoon
  12. False
  13. True
  14. a class leaderboard
  15. False
  16. 4
  17. chat messages to friends
  18. 5
  19. in the cloud
  20. on the phone
  21. True
  22. 5
  23. Kites
  24. 3
  25. Kites
  26. Sports
  27. on the phone
  28. 4
  29. Arjun
  30. 5
  31. your last game level
  32. notes to read offline
  33. a shared to-do list
  34. 5
  35. in the cloud
  36. Sports
  37. Maths
  38. False
  39. 5
  40. Stars

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