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

Answer key

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

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