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

Answer key

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

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