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

Answer key

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

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