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

Answer key

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

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