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

Answer key

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

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