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

Answer key

  1. a shared to-do list
  2. a list
  3. on the phone
  4. the phone is lost
  5. Monsoon
  6. on the phone
  7. the sound on/off setting
  8. Art
  9. Maths
  10. True
  11. 3
  12. Riya
  13. in the cloud
  14. in the cloud
  15. 3
  16. on the phone
  17. chat messages to friends
  18. 8
  19. Riya
  20. Riya
  21. 0
  22. 7
  23. use it on any device
  24. True
  25. 4
  26. 6
  27. on the phone
  28. Monsoon
  29. in the cloud
  30. 4
  31. Meera
  32. Meera
  33. True
  34. Meera
  35. a named box for a value
  36. a draft you are typing
  37. Music
  38. 3
  39. Aman
  40. Rain

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