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

Answer key

  1. 7
  2. data saved on the phone
  3. 4
  4. 4
  5. Maths
  6. Music
  7. Sunrise
  8. in the cloud
  9. Riya
  10. 3
  11. Aman
  12. on the phone
  13. chat messages to friends
  14. on the phone
  15. use it on any device
  16. a named box for a value
  17. True
  18. a list
  19. notes to read offline
  20. Kabir
  21. 4
  22. Ocean
  23. Riya
  24. Stars
  25. 5
  26. 6
  27. photos on two devices
  28. a shared to-do list
  29. in the cloud
  30. 0
  31. Hindi
  32. on the phone
  33. 5
  34. Ocean
  35. the sound on/off setting
  36. 5
  37. 5
  38. a class leaderboard
  39. 3
  40. Rain

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