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

Answer key

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

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