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

Answer key

  1. 4
  2. False
  3. on the phone
  4. Science
  5. Ocean
  6. chat messages to friends
  7. 3
  8. 4
  9. data saved on the phone
  10. Arjun
  11. your last game level
  12. a list
  13. 4
  14. 4
  15. 7
  16. 4
  17. 0
  18. Science
  19. 4
  20. in the cloud
  21. 5
  22. use it on any device
  23. Aman
  24. in the cloud
  25. 3
  26. in the cloud
  27. Hindi
  28. 8
  29. photos on two devices
  30. 3
  31. notes to read offline
  32. on the phone
  33. 5
  34. the sound on/off setting
  35. in the cloud
  36. the phone is lost
  37. Ocean
  38. Ocean
  39. Ocean
  40. 4

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