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

Answer key

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

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