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

Answer key

  1. 3
  2. False
  3. photos on two devices
  4. the sound on/off setting
  5. a list
  6. in the cloud
  7. Kabir
  8. a named box for a value
  9. 3
  10. Monsoon
  11. on the phone
  12. a shared to-do list
  13. False
  14. on the phone
  15. your last game level
  16. a draft you are typing
  17. 1
  18. a class leaderboard
  19. True
  20. False
  21. Rain
  22. 5
  23. 0
  24. 8
  25. 6
  26. 3
  27. 5
  28. Monsoon
  29. True
  30. on the phone
  31. Kites
  32. True
  33. 4
  34. True
  35. 4
  36. 3
  37. Monsoon
  38. on the phone
  39. Riya
  40. Sports

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