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

Answer key

  1. chat messages to friends
  2. True
  3. on the phone
  4. notes to read offline
  5. False
  6. a list
  7. False
  8. 4
  9. True
  10. Aman
  11. Monsoon
  12. Zoya
  13. False
  14. on the phone
  15. a shared to-do list
  16. True
  17. Sunrise
  18. a named box for a value
  19. 3
  20. the phone is lost
  21. False
  22. in the cloud
  23. in the cloud
  24. 5
  25. Hindi
  26. 3
  27. Hindi
  28. 4
  29. 6
  30. on the phone
  31. 3
  32. 6
  33. 5
  34. 7
  35. 5
  36. Aman
  37. 0
  38. Meera
  39. your last game level
  40. Ocean

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