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

Answer key

  1. 5
  2. your last game level
  3. on the phone
  4. 5
  5. False
  6. a draft you are typing
  7. the sound on/off setting
  8. photos on two devices
  9. Science
  10. the phone is lost
  11. Science
  12. False
  13. Rain
  14. Sports
  15. Zoya
  16. True
  17. 4
  18. chat messages to friends
  19. Stars
  20. 3
  21. 6
  22. 3
  23. 0
  24. 3
  25. False
  26. on the phone
  27. a shared to-do list
  28. Sunrise
  29. a class leaderboard
  30. 5
  31. in the cloud
  32. in the cloud
  33. in the cloud
  34. 10
  35. a list
  36. use it on any device
  37. 5
  38. 9
  39. Arjun
  40. False

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