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

Answer key

  1. 4
  2. a shared to-do list
  3. 4
  4. Sunrise
  5. data saved on the phone
  6. 3
  7. 5
  8. a draft you are typing
  9. Zoya
  10. notes to read offline
  11. Science
  12. 5
  13. False
  14. Music
  15. on the phone
  16. your last game level
  17. on the phone
  18. 4
  19. the phone is lost
  20. a named box for a value
  21. False
  22. on the phone
  23. 5
  24. chat messages to friends
  25. True
  26. True
  27. False
  28. on the phone
  29. in the cloud
  30. False
  31. 0
  32. the sound on/off setting
  33. True
  34. 6
  35. Kabir
  36. 4
  37. Kites
  38. True
  39. 4
  40. 7

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