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

Answer key

  1. on the phone
  2. in the cloud
  3. True
  4. 6
  5. False
  6. a list
  7. Hindi
  8. True
  9. Art
  10. Monsoon
  11. on the phone
  12. Zoya
  13. Ocean
  14. 3
  15. the phone is lost
  16. 3
  17. Riya
  18. use it on any device
  19. Ocean
  20. 6
  21. in the cloud
  22. True
  23. False
  24. your last game level
  25. in the cloud
  26. 0
  27. on the phone
  28. Maths
  29. Rain
  30. 4
  31. chat messages to friends
  32. Kabir
  33. Arjun
  34. 6
  35. 4
  36. Music
  37. 4
  38. Aman
  39. Ocean
  40. 8

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