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

Answer key

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

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