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

Answer key

  1. 6
  2. 4
  3. 6
  4. a draft you are typing
  5. 3
  6. photos on two devices
  7. Arjun
  8. in the cloud
  9. on the phone
  10. chat messages to friends
  11. False
  12. False
  13. Meera
  14. True
  15. 4
  16. notes to read offline
  17. 5
  18. 5
  19. a class leaderboard
  20. 4
  21. your last game level
  22. 3
  23. Kites
  24. Meera
  25. 3
  26. 4
  27. True
  28. data saved on the phone
  29. True
  30. use it on any device
  31. Riya
  32. the phone is lost
  33. 5
  34. 5
  35. Riya
  36. 2
  37. False
  38. on the phone
  39. Zoya
  40. Meera

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