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

Answer key

  1. your last game level
  2. False
  3. use it on any device
  4. data saved on the phone
  5. 4
  6. 4
  7. Music
  8. 3
  9. on the phone
  10. True
  11. a draft you are typing
  12. 4
  13. False
  14. in the cloud
  15. 5
  16. on the phone
  17. 10
  18. notes to read offline
  19. on the phone
  20. 4
  21. 5
  22. 6
  23. the sound on/off setting
  24. Music
  25. Hindi
  26. 4
  27. True
  28. 4
  29. 0
  30. 6
  31. chat messages to friends
  32. 7
  33. 5
  34. False
  35. Meera
  36. Zoya
  37. a shared to-do list
  38. Kites
  39. Music
  40. 4

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