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

Answer key

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

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