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

Answer key

  1. the phone is lost
  2. in the cloud
  3. Kabir
  4. 4
  5. Monsoon
  6. Aman
  7. Sports
  8. a named box for a value
  9. 3
  10. use it on any device
  11. notes to read offline
  12. Stars
  13. 8
  14. Zoya
  15. a list
  16. on the phone
  17. a shared to-do list
  18. 3
  19. False
  20. Riya
  21. Meera
  22. 3
  23. False
  24. 4
  25. False
  26. Maths
  27. the sound on/off setting
  28. False
  29. Zoya
  30. a draft you are typing
  31. 5
  32. in the cloud
  33. True
  34. False
  35. 3
  36. on the phone
  37. Sunrise
  38. 5
  39. 3
  40. in the cloud

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