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

Answer key

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

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