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

Answer key

  1. in the cloud
  2. Maths
  3. data saved on the phone
  4. on the phone
  5. Kites
  6. True
  7. a draft you are typing
  8. False
  9. the phone is lost
  10. False
  11. 5
  12. your last game level
  13. Maths
  14. 8
  15. in the cloud
  16. Sunrise
  17. 5
  18. 5
  19. Science
  20. True
  21. Hindi
  22. True
  23. 4
  24. 6
  25. the sound on/off setting
  26. in the cloud
  27. a shared to-do list
  28. Hindi
  29. 10
  30. 4
  31. 7
  32. 8
  33. use it on any device
  34. 0
  35. 5
  36. on the phone
  37. chat messages to friends
  38. 5
  39. False
  40. Monsoon

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