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

Answer key

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

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