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

Answer key

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

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