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

Answer key

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

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