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

Answer key

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

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