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

Answer key

  1. 2
  2. the phone is lost
  3. a draft you are typing
  4. 3
  5. 4
  6. use it on any device
  7. in the cloud
  8. on the phone
  9. Rain
  10. 4
  11. notes to read offline
  12. a named box for a value
  13. False
  14. a list
  15. Stars
  16. in the cloud
  17. on the phone
  18. Rain
  19. True
  20. in the cloud
  21. chat messages to friends
  22. Meera
  23. False
  24. 4
  25. Sunrise
  26. 3
  27. Zoya
  28. True
  29. 5
  30. 1
  31. data saved on the phone
  32. 5
  33. 3
  34. False
  35. 4
  36. True
  37. 3
  38. 3
  39. Kites
  40. Sports

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