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

Answer key

  1. 3
  2. Monsoon
  3. a list
  4. Riya
  5. the sound on/off setting
  6. False
  7. Art
  8. Aman
  9. on the phone
  10. a shared to-do list
  11. your last game level
  12. the phone is lost
  13. 5
  14. Monsoon
  15. False
  16. on the phone
  17. False
  18. 5
  19. 5
  20. Kabir
  21. in the cloud
  22. Science
  23. 0
  24. use it on any device
  25. Meera
  26. True
  27. True
  28. on the phone
  29. Aman
  30. photos on two devices
  31. 3
  32. Arjun
  33. 4
  34. Maths
  35. True
  36. True
  37. False
  38. 5
  39. Monsoon
  40. on the phone

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