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

Answer key

  1. the phone is lost
  2. on the phone
  3. 5
  4. Sunrise
  5. Riya
  6. chat messages to friends
  7. in the cloud
  8. in the cloud
  9. in the cloud
  10. Sunrise
  11. Aman
  12. 4
  13. in the cloud
  14. False
  15. 11
  16. Rain
  17. Arjun
  18. on the phone
  19. Aman
  20. notes to read offline
  21. data saved on the phone
  22. a shared to-do list
  23. True
  24. 5
  25. Sunrise
  26. False
  27. 3
  28. Maths
  29. a named box for a value
  30. 0
  31. photos on two devices
  32. 6
  33. use it on any device
  34. 7
  35. 4
  36. True
  37. True
  38. 4
  39. 6
  40. 3

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