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

Answer key

  1. on the phone
  2. chat messages to friends
  3. 6
  4. False
  5. 5
  6. True
  7. a shared to-do list
  8. a class leaderboard
  9. Maths
  10. Hindi
  11. photos on two devices
  12. True
  13. False
  14. 6
  15. 6
  16. a draft you are typing
  17. Maths
  18. True
  19. Monsoon
  20. False
  21. Rain
  22. your last game level
  23. in the cloud
  24. 2
  25. a list
  26. False
  27. 8
  28. in the cloud
  29. Art
  30. Aman
  31. in the cloud
  32. 0
  33. True
  34. 6
  35. Sunrise
  36. Arjun
  37. 3
  38. Music
  39. on the phone
  40. 5

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