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

Answer key

  1. the phone is lost
  2. 9
  3. a named box for a value
  4. Hindi
  5. Monsoon
  6. notes to read offline
  7. a list
  8. on the phone
  9. your last game level
  10. the sound on/off setting
  11. False
  12. Meera
  13. in the cloud
  14. on the phone
  15. Hindi
  16. True
  17. 3
  18. 8
  19. True
  20. 3
  21. Maths
  22. Sports
  23. 6
  24. 5
  25. on the phone
  26. False
  27. False
  28. data saved on the phone
  29. 4
  30. False
  31. 3
  32. Arjun
  33. 4
  34. in the cloud
  35. 4
  36. True
  37. 0
  38. photos on two devices
  39. 5
  40. 4

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