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

Answer key

  1. use it on any device
  2. a list
  3. on the phone
  4. 0
  5. 5
  6. Meera
  7. 4
  8. your last game level
  9. a shared to-do list
  10. 4
  11. Art
  12. Sports
  13. Riya
  14. in the cloud
  15. the phone is lost
  16. in the cloud
  17. 6
  18. 5
  19. Zoya
  20. 6
  21. data saved on the phone
  22. on the phone
  23. a named box for a value
  24. notes to read offline
  25. 4
  26. in the cloud
  27. 4
  28. True
  29. True
  30. Arjun
  31. Zoya
  32. Stars
  33. True
  34. photos on two devices
  35. chat messages to friends
  36. on the phone
  37. Zoya
  38. 5
  39. 4
  40. in the cloud

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