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

Answer key

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

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