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

Answer key

  1. 5
  2. data saved on the phone
  3. False
  4. in the cloud
  5. Riya
  6. True
  7. True
  8. notes to read offline
  9. 4
  10. True
  11. True
  12. 4
  13. photos on two devices
  14. Arjun
  15. Zoya
  16. use it on any device
  17. 2
  18. on the phone
  19. in the cloud
  20. 5
  21. your last game level
  22. Kabir
  23. Zoya
  24. False
  25. the sound on/off setting
  26. 6
  27. 5
  28. True
  29. 5
  30. 7
  31. 5
  32. Sports
  33. 0
  34. in the cloud
  35. the phone is lost
  36. 4
  37. Ocean
  38. Kabir
  39. 5
  40. Music

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