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

Answer key

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

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